File tree Expand file tree Collapse file tree 1 file changed +38
-9
lines changed
Expand file tree Collapse file tree 1 file changed +38
-9
lines changed Original file line number Diff line number Diff line change @@ -2,20 +2,49 @@ 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+ ENV MIX_ENV=$MIX_ENV
19+ COPY . ./
1920
20- # Install npm dependencies
21- RUN cd assets && npm install
21+ # install application
22+ RUN mix do deps.get, compile
23+
24+ # -----------------
25+ # RELEASE
26+ # -----------------
27+ FROM build AS release
28+
29+ # digests and compresses static files
30+ RUN npm install --prefix assets && npm run deploy --prefix assets
31+
32+ # generate release executable
33+ RUN mix release
34+
35+ # -----------------
36+ # PRODUCTION
37+ # -----------------
38+ FROM alpine:3.18 AS production
39+
40+ WORKDIR /code_comparison
41+
42+ ARG MIX_ENV=prod
43+
44+ # install dependencies
45+ RUN apk add --no-cache ncurses-libs curl
46+
47+ COPY --from=release /code_comparison/_build/$MIX_ENV/rel/code_comparison ./
48+
49+ # start application
50+ CMD ["bin/code_comparison" , "start" ]
You can’t perform that action at this time.
0 commit comments