-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
43 lines (36 loc) · 1.37 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
# Application builder container
# ~~~~~~
FROM bitwalker/alpine-elixir-phoenix:1.7.3 AS builder
LABEL description="Engineers SG GraphQL web service Docker builder image"
# Copy all the necessary files for build and packaging (exclude tests)
WORKDIR /build
COPY /config ./config/
COPY /lib ./lib/
COPY /priv ./priv/
COPY /rel ./rel/
COPY mix.exs mix.lock VERSION.txt ./
# Install dependencies, build distributable package, then cleanup build
# artifacts to keep layer size to a minimum
RUN mix local.hex --force && \
mix local.rebar --force && \
mix install && \
MIX_ENV=prod mix package && \
mkdir dist && \
cp -r _build/prod/rel/esg_graphql dist/ && \
rm -rf _build && \
rm -rf deps
# Application runtime container
# ~~~~~~
FROM bitwalker/alpine-elixir-phoenix:1.7.3
LABEL description="Engineers SG GraphQL web service"
# Copy release package, ready-to-run
WORKDIR /app
COPY --from=builder /build/dist/esg_graphql/ ./
RUN chmod +x bin/esg_graphql
# Set default environment variables
ENV APP_HOST=graphql.engineers.sg \
APP_PORT=4000 \
APP_SECRET=XyJgAdDU8qYoNqELNzJkD0C4ejA0jpjUuwDR+uCkFkYQdHdZ/Sx2G9tMYLqit1Q9
EXPOSE 4000
ENTRYPOINT ["bin/esg_graphql"]
CMD ["foreground"]