-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
56 lines (40 loc) · 1.18 KB
/
Dockerfile
File metadata and controls
56 lines (40 loc) · 1.18 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
FROM elixir:1.18.3-otp-27-slim AS base
WORKDIR /code_comparison
RUN apt-get update && \
apt-get install -y npm inotify-tools ca-certificates curl bash git && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
RUN mix do local.hex --force, local.rebar --force
# -----------------
# BUILD
# -----------------
FROM base AS build
ARG MIX_ENV=prod
ARG SECRET_KEY_BASE=dummy_secret
ENV MIX_ENV=$MIX_ENV
ENV SECRET_KEY_BASE=$SECRET_KEY_BASE
COPY . ./
# install application
RUN mix do deps.get, compile
# -----------------
# RELEASE
# -----------------
FROM build AS release
# Build static assets and digest them
RUN npm install --prefix assets && npm run deploy --prefix assets && mix phx.digest
# generate release executable
RUN mix release
# -----------------
# PRODUCTION
# -----------------
FROM elixir:1.18.3-otp-27-slim AS production
WORKDIR /code_comparison
ARG MIX_ENV=prod
# install dependencies
RUN apt-get update && \
apt-get install -y ncurses-bin curl && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
COPY --from=release /code_comparison/_build/$MIX_ENV/rel/code_comparison ./
COPY --from=build /code_comparison/topics ./topics
CMD ["bin/code_comparison", "start"]