Put env directly when building docker images

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2022-04-07 14:44:11 +02:00
parent d01bbcad98
commit 5bb1247f37
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773
2 changed files with 2 additions and 6 deletions

View File

@ -9,8 +9,6 @@ ENV ELIXIR_VERSION latest
ENV ERLANG_VERSION latest ENV ERLANG_VERSION latest
ENV NODE_VERSION 16 ENV NODE_VERSION 16
ENV HEX_MIRROR="https://cdn.jsdelivr.net/hex"
# Install system dependencies # Install system dependencies
RUN apt-get update -yq && apt-get install -yq build-essential cmake postgresql-client git curl gnupg unzip exiftool webp imagemagick gifsicle RUN apt-get update -yq && apt-get install -yq build-essential cmake postgresql-client git curl gnupg unzip exiftool webp imagemagick gifsicle
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
@ -34,7 +32,7 @@ WORKDIR /mobilizon
# Elixir release # Elixir release
RUN source /root/.bashrc && \ RUN source /root/.bashrc && \
mix deps.get --only prod && \ HEX_MIRROR="https://cdn.jsdelivr.net/hex" mix deps.get --only prod && \
mix compile && \ mix compile && \
mix phx.digest.clean --all && \ mix phx.digest.clean --all && \
mix release --path release/mobilizon && \ mix release --path release/mobilizon && \

View File

@ -14,15 +14,13 @@ RUN yarn install --network-timeout 100000 \
# Then, build the application binary # Then, build the application binary
FROM elixir:1.13-alpine AS builder FROM elixir:1.13-alpine AS builder
ENV HEX_MIRROR="https://cdn.jsdelivr.net/hex"
RUN apk add --no-cache build-base git cmake RUN apk add --no-cache build-base git cmake
COPY mix.exs mix.lock ./ COPY mix.exs mix.lock ./
ENV MIX_ENV=prod ENV MIX_ENV=prod
RUN mix local.hex --force \ RUN mix local.hex --force \
&& mix local.rebar --force \ && mix local.rebar --force \
&& mix deps.get && HEX_MIRROR="https://cdn.jsdelivr.net/hex" mix deps.get
COPY lib ./lib COPY lib ./lib
COPY priv ./priv COPY priv ./priv