-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
37 lines (31 loc) · 1.17 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
FROM elixir:1.13.3-alpine AS builder
WORKDIR /opt/app
ENTRYPOINT [ "./bin/application" ]
RUN apk add --no-cache bash build-base inotify-tools git
RUN mix local.rebar --force && mix local.hex --force
ADD mix.exs mix.lock ./
RUN MIX_ENV=dev mix do deps.get, deps.compile
RUN grep 'version:' mix.exs | cut -d '"' -f2 > .version
ADD . ./
RUN mkdir -p /opt/built && \
MIX_ENV=prod SECRET_KEY_BASE=fake mix deps.get && \
MIX_ENV=prod SECRET_KEY_BASE=fake mix compile && \
MIX_ENV=prod SECRET_KEY_BASE=fake mix distillery.release && \
cp _build/prod/rel/castle/releases/$(cat .version)/castle.tar.gz /opt/built && \
cd /opt/built && \
tar -xzf castle.tar.gz && \
rm castle.tar.gz
# NOTE: alpine version here must match the above elixir image
# you can find with "grep VERSION_ID /etc/os-release | cut -d "=" -f2"
FROM alpine:3.15.0 AS built
LABEL maintainer="PRX <[email protected]>"
LABEL org.prx.app="yes"
LABEL org.prx.spire.publish.ecr="ELIXIR_APP"
RUN apk add --no-cache bash openssl-dev libstdc++
ENV MIX_ENV=prod
ENV USE_BUILT=true
WORKDIR /opt/app
COPY --from=builder /opt/built .
COPY --from=builder /opt/app/bin/* bin/
ENTRYPOINT [ "./bin/application" ]
CMD web