-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
57 lines (45 loc) · 1.3 KB
/
Dockerfile
File metadata and controls
57 lines (45 loc) · 1.3 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
54
55
56
57
ARG CRYSTAL_VERSION=latest
FROM placeos/crystal:$CRYSTAL_VERSION as build
WORKDIR /app
# Set the commit via a build arg
ARG PLACE_COMMIT="DEV"
# Set the platform version via a build arg
ARG PLACE_VERSION="DEV"
# Install shards for caching
COPY shard.* .
RUN shards install --production --ignore-crystal-version --skip-postinstall --skip-executables
# Add source last for efficient caching
COPY src /app/src
# Build the required target
RUN PLACE_COMMIT=${PLACE_COMMIT} \
PLACE_VERSION=${PLACE_VERSION} \
UNAME_AT_COMPILE_TIME=true \
CRYSTAL_VERSION=${CRYSTAL_VERSION} \
shards build \
build \
--debug \
--error-trace \
--production \
--release
RUN rm -r lib src
# Add scripts
COPY scripts /app/scripts
###############################################################################
ENV HOME="/app"
ENV SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt
ARG IMAGE_UID="10001"
ENV UID=$IMAGE_UID
ENV USER=appuser
# Create a non-privileged user
RUN adduser \
--disabled-password \
--gecos "" \
--home "${HOME}" \
--shell "/sbin/nologin" \
--uid "${UID}" \
"${USER}"
RUN chown appuser -R /app
EXPOSE 3000
ENTRYPOINT ["/app/bin/build", "server"]
HEALTHCHECK CMD ["/app/bin/build", "server", "--curl", "http://localhost:3000/api/build/v1"]
CMD ["/app/bin/build", "server"]