testing build and test
This commit is contained in:
@@ -1,39 +1,58 @@
|
||||
FROM hexpm/elixir:1.15.7-erlang-26.1.2-alpine-3.18.4 AS build
|
||||
ARG ELIXIR_VERSION=1.18.4
|
||||
ARG OTP_VERSION=27.3.4.8
|
||||
ARG DEBIAN_VERSION=trixie-20260223-slim
|
||||
|
||||
ARG BUILDER_IMAGE="docker.io/hexpm/elixir:${ELIXIR_VERSION}-erlang-${OTP_VERSION}-debian-${DEBIAN_VERSION}"
|
||||
ARG RUNNER_IMAGE="docker.io/debian:${DEBIAN_VERSION}"
|
||||
|
||||
FROM ${BUILDER_IMAGE} AS builder
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends build-essential git \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN apk add --no-cache build-base git
|
||||
WORKDIR /app
|
||||
RUN mix local.hex --force && \
|
||||
mix local.rebar --force
|
||||
ENV MIX_ENV=prod
|
||||
|
||||
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
|
||||
COPY lib lib
|
||||
|
||||
RUN mix compile
|
||||
|
||||
COPY config/runtime.exs config/
|
||||
RUN mix release
|
||||
|
||||
FROM alpine:3.18.4 AS app
|
||||
FROM ${RUNNER_IMAGE} AS final
|
||||
|
||||
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
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends libstdc++6 openssl libncurses6 locales ca-certificates \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY --from=build --chown=elixir:elixir /app/_build/prod/rel/backend ./
|
||||
RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen \
|
||||
&& locale-gen
|
||||
|
||||
USER elixir
|
||||
ENV LANG=en_US.UTF-8
|
||||
ENV LANGUAGE=en_US:en
|
||||
ENV LC_ALL=en_US.UTF-8
|
||||
|
||||
WORKDIR "/app"
|
||||
RUN chown nobody /app
|
||||
|
||||
ENV MIX_ENV="prod"
|
||||
|
||||
COPY --from=builder --chown=nobody:root /app/_build/${MIX_ENV}/rel/backend ./
|
||||
|
||||
USER nobody
|
||||
|
||||
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