-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathDockerfile
45 lines (29 loc) · 949 Bytes
/
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
FROM node:12-slim as client_build
RUN mkdir /opt/app
COPY locales/ /opt/app/locales
COPY client/package*.json /opt/app/client/
WORKDIR /opt/app/client
RUN npm ci
COPY client/ ./
RUN npm run build
FROM elixir:1.10.3 as server_build
COPY --from=client_build /opt/app /opt/app
WORKDIR /opt/app/server
COPY server/ ./
ARG APP_NAME=drawit
ARG APP_VSN=
ARG MIX_ENV=prod
ENV MIX_ENV=${MIX_ENV} \
APP_NAME=${APP_NAME} \
APP_VSN=${APP_VSN}
RUN mix do local.rebar --force, local.hex --if-missing --force
RUN mix do deps.get --only $MIX_ENV, deps.compile
RUN mix distillery.release --verbose && \
cd _build/${MIX_ENV}/rel/$APP_NAME/releases/$APP_VSN && \
tar -xzf $APP_NAME.tar.gz && \
rm $APP_NAME.tar.gz
WORKDIR /opt/app
RUN useradd -d /home/drawit -m -s /bin/bash drawit
RUN chown -R drawit:drawit /opt/app/server
USER drawit
CMD trap 'exit' INT; server/_build/$MIX_ENV/rel/$APP_NAME/releases/$APP_VSN/bin/$APP_NAME foreground