1.5 KiB · text History 9d57f0c
# Elixir 1.17+ and OTP 27+ are what httpoison 3 and hackney 4 need; this is
# the pair dev runs on. Not pinned to the patch: the 1.20.x-otp-28-alpine tags
# have shipped without an amd64 image, while this one carries it.
FROM docker.io/elixir:1.20-otp-28-alpine
MAINTAINER Gabe <gmp@gmp.io>
ARG app_name=apollos_crib
ARG phoenix_subdir=.
ARG build_env=prod
ENV MIX_ENV=${build_env} TERM=xterm
WORKDIR /opt/app
RUN apk update \
    && apk --no-cache --update add git make gcc g++ erlang-dev openssl-dev npm openssh gnu-libiconv \
    && mix local.rebar --force \
    && mix local.hex --force
COPY . .
RUN mix do deps.get, compile
RUN npm install -g npm@6.14.4
RUN cd ${phoenix_subdir}/apps/room_sanctum/assets \
    && npm ci \
    && cd ../ \
    && mix download_data \
    && mix phx.digest \
    && mix assets.deploy \
    && cd ../../ \
RUN mix download_data
# The source lines Sentry sends with a stack trace; config/prod.exs says which.
RUN mix sentry.package_source_code
RUN mix release ${app_name} \
    && mv _build/${build_env}/rel/${app_name} /opt/release \
    && mv /opt/release/bin/${app_name} /opt/release/bin/start_server
FROM alpine:latest
ARG project_id
RUN apk update \
    && apk --no-cache --update add bash ca-certificates openssl-dev libgcc libstdc++ librsvg imagemagick libcrypto3
EXPOSE 4002
EXPOSE 4001
WORKDIR /opt/app
COPY --from=0 /opt/release .
COPY rel/entrypoint.sh /opt/app/entrypoint.sh
RUN chmod +x /opt/app/entrypoint.sh
CMD ["/opt/app/entrypoint.sh"]