Skip to content

Commit 9b2d508

Browse files
committed
refactor: streamline Dockerfile by consolidating Node.js stage and updating Puppeteer cache installation
1 parent cc74b30 commit 9b2d508

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

Dockerfile

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ ARG BUILDER_IMAGE="hexpm/elixir:${ELIXIR_VERSION}-erlang-${OTP_VERSION}-debian-$
2121
ARG RUNNER_IMAGE="debian:${DEBIAN_VERSION}"
2222
ARG NODE_IMAGE="node:${NODE_VERSION}"
2323

24+
FROM ${NODE_IMAGE} as node
25+
26+
RUN PUPPETEER_CACHE_DIR=/app/puppeteer npx --yes puppeteer browsers install
2427

2528
FROM ${BUILDER_IMAGE} as builder
2629

@@ -55,7 +58,7 @@ COPY lib lib
5558

5659
COPY assets assets
5760

58-
COPY --from=node:23-bookworm-slim /usr/local/bin /usr/local/bin
61+
COPY --from=node /usr/local/bin /usr/local/bin
5962

6063
# compile assets
6164
RUN mix assets.deploy
@@ -69,10 +72,6 @@ COPY config/runtime.exs config/
6972
COPY rel rel
7073
RUN mix release
7174

72-
FROM ${NODE_IMAGE} as node
73-
74-
RUN PUPPETEER_CACHE_DIR=/app/puppeteer npx --yes puppeteer browsers install
75-
7675
# start a new build stage so that the final image will only contain
7776
# the compiled release and other runtime necessities
7877
FROM ${RUNNER_IMAGE}
@@ -84,7 +83,7 @@ RUN apt-get update -y && \
8483
# TODO: remove after migration
8584
RUN apt-get update -y && apt-get install -y postgresql-client
8685

87-
COPY --from=node:23-bookworm-slim /usr/local/bin /usr/local/bin
86+
COPY --from=node /usr/local/bin /usr/local/bin
8887

8988
RUN apt-get update -y && apt-get install -y ca-certificates fonts-liberation libasound2 libatk-bridge2.0-0 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgbm1 libgcc1 libglib2.0-0 libgtk-3-0 libnspr4 libnss3 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 lsb-release wget xdg-utils
9089

@@ -104,7 +103,7 @@ ENV MIX_ENV="prod"
104103
# Copy the final release from the build stage
105104
COPY --from=builder --chown=nobody:root /app/_build/${MIX_ENV}/rel/algora ./
106105

107-
# Copy the puppeteer cache from the build stage
106+
# Copy the puppeteer cache from the node stage
108107
COPY --from=node --chown=nobody:root /app/puppeteer ./puppeteer
109108

110109
USER nobody

0 commit comments

Comments
 (0)