This repository was archived by the owner on Sep 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
104 lines (78 loc) · 2.42 KB
/
Dockerfile
File metadata and controls
104 lines (78 loc) · 2.42 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
FROM debian:stretch as builder
ARG ERLANG_VERSION=1:22.3.2-1
ARG ELIXIR_VERSION=1.10.1-1
ARG MIX_ENV=prod
ENV ERLANG_VERSION ${ERLANG_VERSION}
ENV ELIXIR_VERSION ${ELIXIR_VERSION}
ENV MIX_ENV ${MIX_ENV}
SHELL ["/bin/bash", "-c"]
# Handle locales
RUN apt-get update && \
apt-get install --yes locales && \
sed -i '/^#.* en_US.UTF-8 /s/^#//' /etc/locale.gen && \
locale-gen
ENV LANG="en_US.UTF-8" LANGUAGE="en_US:en"
# Install build utils
RUN apt-get install --yes \
wget \
unzip \
build-essential \
apt-transport-https \
git \
curl
# Install Erlang & Elixir
RUN echo "deb https://packages.erlang-solutions.com/debian stretch contrib" >> /etc/apt/sources.list && \
cat /etc/apt/sources.list && \
wget --quiet -O - https://packages.erlang-solutions.com/debian/erlang_solutions.asc | apt-key add - && \
apt-get update && \
apt-get install --yes \
esl-erlang=$ERLANG_VERSION \
elixir=$ELIXIR_VERSION
# Install NodeJS
RUN curl -sL https://deb.nodesource.com/setup_12.x | bash -
RUN apt-get install -y nodejs
WORKDIR /build
# install hex + rebar
RUN mix local.hex --force && \
mix local.rebar --force
# set build ENV
ENV MIX_ENV=prod
# install mix dependencies
COPY mix.exs mix.lock ./
COPY config config
RUN mix do deps.get, deps.compile
# build assets
COPY assets/package.json assets/package-lock.json ./assets/
RUN npm --prefix ./assets ci --progress=false --no-audit --loglevel=error
COPY priv priv
COPY assets assets
RUN npm run --prefix ./assets deploy
RUN mix phx.digest
# compile and build release
COPY lib lib
COPY rel rel
RUN mix do compile, release
RUN mkdir /release && \
cp -r _build/prod/rel/pointing_poker/* /release/
FROM debian:stretch-slim
# Handle locales
RUN apt-get update && \
apt-get install --yes locales && \
sed -i '/^#.* en_US.UTF-8 /s/^#//' /etc/locale.gen && \
locale-gen
ENV LANG="en_US.UTF-8" LANGUAGE="en_US:en"
# libcrypto.so is required by ERTS. curl for healthcheck.
RUN apt-get install --yes \
libssl1.1 \
curl
WORKDIR /app
COPY --from=builder /release/ .
RUN groupadd -r app && useradd -r -g app app
RUN chown -R app /app
USER app
EXPOSE 4000
EXPOSE 45892/udp
EXPOSE 4369-4370
HEALTHCHECK --interval=30s --timeout=30s --retries=3 --start-period=5s \
CMD curl --silent localhost:4000/ || exit 1
CMD trap 'exit' INT; /app/bin/pointing_poker start