-
Notifications
You must be signed in to change notification settings - Fork 7
/
Dockerfile
65 lines (50 loc) · 1.6 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
FROM node:lts-slim as frontend-build
# see https://github.com/webpack/webpack/issues/14532
ENV NODE_OPTIONS=--openssl-legacy-provider
COPY frontend/ ./frontend
WORKDIR ./frontend
RUN npm i
RUN npm run build-prod
FROM eclipse-temurin:17-jdk AS backend-build
ENV PROJECT_ROOT /src
WORKDIR $PROJECT_ROOT
# Copy gradle settings
COPY backend/build.gradle.kts backend/settings.gradle.kts backend/gradle.properties backend/gradlew $PROJECT_ROOT/
# Make sure gradlew is executable
RUN chmod +x gradlew
# Copy gradle specification
COPY backend/gradle $PROJECT_ROOT/gradle
# Download gradle
RUN ./gradlew --version
# download and cache dependencies
RUN ./gradlew resolveDependencies --no-daemon
# Copy project and build
COPY backend/ $PROJECT_ROOT
RUN ./gradlew distTar --no-daemon
# Runtime
FROM eclipse-temurin:17-jre as runtime
LABEL description="Mild Blue Covid Vaxx"
LABEL project="mild-blue:covid-vaxx"
# prepare logging
ENV FILE_LOG_PATH=/var/logs/mildblue
RUN mkdir -p $FILE_LOG_PATH
ENV PRODUCTION_LOGGING=true
ENV ENABLE_FILE_LOG=true
ENV APP_ROOT /app
WORKDIR $APP_ROOT
# Copy frontend
ENV FRONTEND_PATH=/app/frontend
COPY --from=frontend-build ./frontend/dist/frontend $FRONTEND_PATH
# Copy backend
COPY --from=backend-build /src/build/distributions/app.tar $APP_ROOT/
# Extract executables
RUN mkdir $APP_ROOT/run
RUN tar -xvf app.tar --strip-components=1 -C $APP_ROOT/run
# create version file
ARG release_version=development
ENV RELEASE_FILE_PATH=$APP_ROOT/run/release.txt
RUN echo $release_version > $RELEASE_FILE_PATH
# setup env
ENV PORT=8080
EXPOSE $PORT
ENTRYPOINT ["/bin/sh", "-c", "/app/run/bin/covid-vaxx"]