-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile.va-app
78 lines (60 loc) · 2.02 KB
/
Dockerfile.va-app
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
66
67
68
69
70
71
72
73
74
75
76
77
78
#
# Builder for frontend JS
#
ARG NODE_VERSION
FROM node:${NODE_VERSION}-alpine AS web-builder
ARG REVISION
WORKDIR /app
COPY package.json package-lock.json ./
RUN --mount=type=cache,target=/root/.npm npm ci
RUN mkdir -p server/resources/public/hakija/
RUN mkdir -p server/resources/public/virkailija/
COPY soresu-form/web/ soresu-form/web/
COPY va-virkailija/web/ va-virkailija/web/
COPY server/resources/public/translations.json server/resources/public/translations.json
COPY va-hakija/web/ va-hakija/web/
COPY .babelrc webpack.config.js common-tsconfig.json tsconfig.json ./
# add git version ID. Fail if missing
RUN test -n "${REVISION}"
RUN echo ${REVISION} > server/resources/public/version.txt
RUN npm run build-production
#
# va-base with all the Clojure stuff
#
FROM eclipse-temurin:8u412-b08-jdk-jammy@sha256:45cd3710559d71f3723618971d458b05e92b394fe900459b98fc3909f9298a97 AS va-base
WORKDIR /app
# lein downloads itself on first run, so prime it here
COPY lein .
RUN ./lein
# fetch dependencies
COPY project.clj .
RUN --mount=type=cache,target=/root/.m2 ./lein deps
# add project code
COPY server/src/ ./server/src/
COPY server/resources/ ./server/resources/
RUN ./lein compile :all
COPY entrypoint.sh .
COPY server/config/ ./server/config/
COPY va-hakija/config/ ./va-hakija/config/
COPY --from=web-builder /app/server/resources/public/hakija/js/ server/resources/public/hakija/js/
COPY --from=web-builder /app/server/resources/public/virkailija/js/ server/resources/public/virkailija/js/
COPY --from=web-builder /app/server/resources/public/version.txt server/resources/public/version.txt
#
# uberjar builder
#
FROM va-base AS uberjar-builder
RUN ./lein uberjar
#
# va-uberjar (only contains the built jar for easy extraction)
#
FROM scratch AS va-uberjar
ARG UBERJAR_NAME
COPY --from=uberjar-builder \
/app/target/uberjar/valtionavustus-0.1.0-SNAPSHOT-standalone.jar \
/${UBERJAR_NAME}
#
# va-server
#
FROM va-base
LABEL org.opencontainers.image.source=https://github.com/opetushallitus/valtionavustus
ENTRYPOINT ["./entrypoint.sh"]