forked from potsda.mn/mobilizon
make build faster using buildlkit
- use annotation for buildkit - cache yarn packages - compile before copying assets to allow parallel build of phases to use it, run `DOCKER_BUILDKIT=1 docker image build -f docker/production/Dockerfile .`
This commit is contained in:
parent
f4cfed1bdf
commit
c408c04bb0
|
@ -1,11 +1,13 @@
|
||||||
|
# syntax=docker/dockerfile:1.2
|
||||||
|
|
||||||
# First build the application assets
|
# First build the application assets
|
||||||
FROM node:16-alpine as assets
|
FROM node:16-alpine as assets
|
||||||
|
|
||||||
RUN apk add --no-cache python3 build-base libwebp-tools bash imagemagick ncurses
|
RUN apk add --no-cache python3 build-base libwebp-tools bash imagemagick ncurses
|
||||||
WORKDIR /build
|
WORKDIR /build
|
||||||
COPY js .
|
COPY js .
|
||||||
RUN yarn install \
|
RUN --mount=type=cache,target=/root/.cache yarn install
|
||||||
&& yarn run build
|
RUN yarn run build
|
||||||
|
|
||||||
# Then, build the application binary
|
# Then, build the application binary
|
||||||
FROM elixir:1.12-alpine AS builder
|
FROM elixir:1.12-alpine AS builder
|
||||||
|
@ -24,6 +26,9 @@ COPY config/config.exs config/prod.exs ./config/
|
||||||
COPY config/docker.exs ./config/runtime.exs
|
COPY config/docker.exs ./config/runtime.exs
|
||||||
COPY rel ./rel
|
COPY rel ./rel
|
||||||
COPY support ./support
|
COPY support ./support
|
||||||
|
|
||||||
|
RUN mix compile
|
||||||
|
|
||||||
COPY --from=assets ./priv/static ./priv/static
|
COPY --from=assets ./priv/static ./priv/static
|
||||||
|
|
||||||
RUN mix phx.digest \
|
RUN mix phx.digest \
|
||||||
|
|
Loading…
Reference in a new issue