-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathDockerfile
61 lines (45 loc) · 1.43 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
# heavily borrowed from https://elixirforum.com/t/cannot-find-libtinfo-so-6-when-launching-elixir-app/24101/11?u=sigu
FROM elixir:1.11.2 AS app_builder
ARG env=prod
ENV LANG=C.UTF-8 \
TERM=xterm \
MIX_ENV=$env
RUN mkdir /opt/release
WORKDIR /opt/release
RUN mix local.hex --force && mix local.rebar --force
COPY mix.exs .
COPY mix.lock .
RUN mix deps.get && mix deps.compile
# Let's make sure we have node
RUN curl -sL https://deb.nodesource.com/setup_14.x | bash - && \
apt-get install -y nodejs
# Compile assets
COPY assets ./assets
RUN npm install --prefix ./assets && \
npm run deploy --prefix ./assets
# Now, let's go with the actual elixir code. The order matters: if we only
# change elixir code, all the above layers will be cached ~ less image build time.
COPY config ./config
COPY lib ./lib
COPY priv ./priv
# Final build step: digest static assets and generate the release
RUN mix phx.digest && mix release
FROM debian:buster-slim AS app
ARG CLIENT_ID=:sfractal2020
ARG MQTT_HOST=34.86.117.113
ARG MQTT_PORT=1883
ARG USER_NAME=plug
ARG PASSWORD=fest
ENV LANG=C.UTF-8
ENV CLIENT_ID=$CLIENT_ID
ENV MQTT_HOST=$CLIENT_ID
ENV MQTT_PORT=$MQTT_PORT
ENV USER_NAME=$USER_NAME
ENV PASSWORD=$PASSWORD
RUN apt-get update && apt-get install -y openssl
RUN useradd --create-home app
WORKDIR /home/app
COPY --from=app_builder /opt/release/_build .
RUN chown -R app: ./prod
USER app
CMD ["./prod/rel/twinkly_maha/bin/twinkly_maha", "start"]