File tree Expand file tree Collapse file tree 1 file changed +41
-9
lines changed
Expand file tree Collapse file tree 1 file changed +41
-9
lines changed Original file line number Diff line number Diff line change @@ -2,20 +2,52 @@ FROM elixir:1.18.3-otp-27-slim AS base
22
33WORKDIR /code_comparison
44
5- # Install system dependencies first!
65RUN apt-get update && \
7- apt-get install -y npm inotify-tools ca-certificates && \
6+ apt-get install -y npm inotify-tools ca-certificates curl bash git && \
87 apt-get clean && \
98 rm -rf /var/lib/apt/lists/*
109
11- # Now it's safe to run mix commands
1210RUN mix do local.hex --force, local.rebar --force
1311
14- # Copy the entire application
15- COPY . .
12+ # -----------------
13+ # BUILD
14+ # -----------------
15+ FROM base AS build
1616
17- # Install Elixir dependencies
18- RUN mix deps.get
17+ ARG MIX_ENV=prod
18+ ARG SECRET_KEY_BASE=dummy_secret
19+ ENV MIX_ENV=$MIX_ENV
20+ ENV SECRET_KEY_BASE=$SECRET_KEY_BASE
1921
20- # Install npm dependencies
21- RUN cd assets && npm install
22+ COPY . ./
23+
24+ # install application
25+ RUN mix do deps.get, compile
26+
27+ # -----------------
28+ # RELEASE
29+ # -----------------
30+ FROM build AS release
31+
32+ # digests and compresses static files
33+ RUN npm install --prefix assets && npm run deploy --prefix assets
34+
35+ # generate release executable
36+ RUN mix release
37+
38+ # -----------------
39+ # PRODUCTION
40+ # -----------------
41+ FROM alpine:3.18 AS production
42+
43+ WORKDIR /code_comparison
44+
45+ ARG MIX_ENV=prod
46+
47+ # install dependencies
48+ RUN apk add --no-cache ncurses-libs curl
49+
50+ COPY --from=release /code_comparison/_build/$MIX_ENV/rel/code_comparison ./
51+
52+ # start application
53+ CMD ["bin/code_comparison" , "start" ]
You can’t perform that action at this time.
0 commit comments