forked from civiform/civiform
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprod.Dockerfile
More file actions
53 lines (44 loc) · 2.02 KB
/
prod.Dockerfile
File metadata and controls
53 lines (44 loc) · 2.02 KB
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
# syntax=docker/dockerfile:1@sha256:b6afd42430b15f2d2a4c5a02b919e98a525b785b1aaff16747d2f623364e39b6
# For production images, use the adoptium.net official JRE & JDK docker images.
FROM eclipse-temurin:25.0.2_10-jdk-alpine@sha256:da683f4f02f9427597d8fa162b73b8222fe08596dcebaf23e4399576ff8b037e AS stage1
ARG SBT_VERSION
ENV SBT_VERSION="${SBT_VERSION}"
ENV INSTALL_DIR=/usr/local
ENV SBT_HOME=/usr/local/sbt
ENV PATH="${PATH}:${SBT_HOME}/bin"
ENV SBT_URL="https://github.com/sbt/sbt/releases/download/v$SBT_VERSION/sbt-$SBT_VERSION.tgz"
RUN set -o pipefail && \
apk update && \
apk add --upgrade apk-tools && \
apk upgrade --available && \
apk add --no-cache --update bash wget npm git && \
mkdir -p "$SBT_HOME" && \
wget -qO - "${SBT_URL}" | tar xz -C "${INSTALL_DIR}" && \
echo -ne "- with sbt $SBT_VERSION\n" >> /root/.built
ENV PROJECT_HOME=/usr/src
ENV PROJECT_NAME=server
ENV PROJECT_LOC="${PROJECT_HOME}/${PROJECT_NAME}"
COPY "${PROJECT_NAME}" "${PROJECT_LOC}"
RUN cd "${PROJECT_LOC}" && \
npm install -g npm && \
npm ci && \
npm run build && \
sbt update && \
sbt dist && \
unzip "${PROJECT_LOC}/target/universal/civiform-server-0.0.1.zip" -d / && \
chmod +x /civiform-server-0.0.1/bin/civiform-server
# This is a common trick to shrink container sizes. We discard everything added
# during the build phase and use only the inflated artifacts created by sbt dist.
FROM eclipse-temurin:25.0.2_10-jre-alpine@sha256:f10d6259d0798c1e12179b6bf3b63cea0d6843f7b09c9f9c9c422c50e44379ec AS stage2
COPY --from=stage1 /civiform-server-0.0.1 /civiform-server-0.0.1
# Upgrade packages for stage2 to include latest versions.
RUN set -o pipefail && \
apk update && \
apk add --upgrade apk-tools && \
apk upgrade --available && \
apk add --no-cache --update bash openssh
ARG image_tag
ENV CIVIFORM_IMAGE_TAG=$image_tag
ARG git_commit_sha
LABEL civiform.git.commit_sha=$git_commit_sha
CMD ["/civiform-server-0.0.1/bin/civiform-server", "-Dconfig.file=/civiform-server-0.0.1/conf/application.conf"]