backend
This commit is contained in:
39
backend/Dockerfile
Normal file
39
backend/Dockerfile
Normal file
@@ -0,0 +1,39 @@
|
||||
FROM hexpm/elixir:1.15.7-erlang-26.1.2-alpine-3.18.4 AS build
|
||||
|
||||
RUN apk add --no-cache build-base git
|
||||
WORKDIR /app
|
||||
RUN mix local.hex --force && \
|
||||
mix local.rebar --force
|
||||
ENV MIX_ENV=prod
|
||||
COPY mix.exs mix.lock ./
|
||||
RUN mix deps.get --only $MIX_ENV
|
||||
RUN mkdir config
|
||||
|
||||
COPY config/config.exs config/${MIX_ENV}.exs config/
|
||||
RUN mix deps.compile
|
||||
COPY lib lib
|
||||
RUN mix compile
|
||||
COPY config/runtime.exs config/
|
||||
|
||||
COPY priv priv
|
||||
RUN mix release
|
||||
|
||||
FROM alpine:3.18.4 AS app
|
||||
|
||||
RUN apk add --no-cache libstdc++ openssl ncurses-libs bash
|
||||
ENV USER="elixir"
|
||||
WORKDIR /app
|
||||
RUN addgroup -g 1000 $USER && \
|
||||
adduser -D -u 1000 -G $USER $USER
|
||||
|
||||
COPY --from=build --chown=elixir:elixir /app/_build/prod/rel/backend ./
|
||||
|
||||
USER elixir
|
||||
|
||||
ENV HOME=/app
|
||||
ENV MIX_ENV=prod
|
||||
ENV PHX_SERVER=true
|
||||
|
||||
EXPOSE 4000 4369 9000-9100
|
||||
|
||||
CMD ["/app/bin/backend", "start"]
|
||||
Reference in New Issue
Block a user