FROM openjdk:15-ea-jdk-alpine

RUN apk --no-cache add libpcap npm

COPY ./ /app/

WORKDIR /app/frontend/

RUN npm install && npm run build && npm cache clean --force \
    && mkdir -p ../src/main/resources/static/ \
	&& mv ./dist/* ../src/main/resources/static/ \
	&& rm -rf node_modules

WORKDIR /app/

RUN ./gradlew --no-daemon --no-build-cache build -x test \
    && cp build/libs/packmate-*.jar app.jar \
    && ./gradlew --no-daemon clean

EXPOSE 65000:65000
