forked from peapescarte/pescarte-plataforma
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.release
47 lines (33 loc) · 986 Bytes
/
Dockerfile.release
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
# ---- Builder Stage ----
FROM bitwalker/alpine-elixir:latest AS builder
MAINTAINER matdsoupe
RUN apk add --no-cache build-base
RUN mkdir /app
WORKDIR /app
ENV MIX_ENV=prod
# Cache elixir deps
ADD ./mix.exs ./mix.lock ./
RUN mix do local.rebar --force, local.hex --force
RUN mix do deps.get, deps.compile
COPY lib ./lib
COPY config ./config
COPY priv ./priv
RUN mix release
# ---- Application Stage ----
FROM alpine AS app
ENV MIX_ENV=prod
# Install needed packages
RUN apk update \
&& apk add --no-cache ncurses-libs postgresql-client tzdata \
&& cp /usr/share/zoneinfo/America/Sao_Paulo /etc/localtime \
&& echo "America/Sao_Paulo" > /etc/timezone \
&& apk del tzdata
# Copy over the build artifact from the previous step and create a non root user
RUN adduser -D -h /home/fuschia fuschia
WORKDIR /home/fuschia
COPY --from=builder /app/_build .
RUN chown -R fuschia: ./prod
USER fuschia
COPY entrypoint.sh .
# Run the Phoenix app
CMD ["./entrypoint.sh"]