Merge pull request #688 from stumpylog/feature/docker-file-reduce
fix: reduce Docker image size
This commit is contained in:
commit
33a654d21a
40
Dockerfile
40
Dockerfile
|
@ -1,4 +1,16 @@
|
||||||
FROM node:18.18-bullseye-slim
|
# Stage: monolith-builder
|
||||||
|
# Purpose: Uses the Rust image to build monolith
|
||||||
|
# Notes:
|
||||||
|
# - Fine to leave extra here, as only the resulting binary is copied out
|
||||||
|
FROM docker.io/rust:1.80-bullseye AS monolith-builder
|
||||||
|
|
||||||
|
RUN set -eux && cargo install --locked monolith
|
||||||
|
|
||||||
|
# Stage: main-app
|
||||||
|
# Purpose: Compiles the frontend and
|
||||||
|
# Notes:
|
||||||
|
# - Nothing extra should be left here. All commands should cleanup
|
||||||
|
FROM node:18.18-bullseye-slim AS main-app
|
||||||
|
|
||||||
ARG DEBIAN_FRONTEND=noninteractive
|
ARG DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
@ -8,30 +20,18 @@ WORKDIR /data
|
||||||
|
|
||||||
COPY ./package.json ./yarn.lock ./playwright.config.ts ./
|
COPY ./package.json ./yarn.lock ./playwright.config.ts ./
|
||||||
|
|
||||||
RUN --mount=type=cache,sharing=locked,target=/usr/local/share/.cache/yarn yarn install --network-timeout 10000000
|
RUN --mount=type=cache,sharing=locked,target=/usr/local/share/.cache/yarn \
|
||||||
|
set -eux && \
|
||||||
|
yarn install --network-timeout 10000000
|
||||||
|
|
||||||
RUN apt-get update
|
# Copy the compiled monolith binary from the builder stage
|
||||||
|
COPY --from=monolith-builder /usr/local/cargo/bin/monolith /usr/local/bin/monolith
|
||||||
|
|
||||||
RUN apt-get install -y \
|
RUN set -eux && \
|
||||||
build-essential \
|
npx playwright install --with-deps chromium && \
|
||||||
curl \
|
|
||||||
libssl-dev \
|
|
||||||
pkg-config
|
|
||||||
|
|
||||||
RUN apt-get update
|
|
||||||
|
|
||||||
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y
|
|
||||||
|
|
||||||
ENV PATH="/root/.cargo/bin:${PATH}"
|
|
||||||
|
|
||||||
RUN cargo install monolith
|
|
||||||
|
|
||||||
RUN npx playwright install-deps && \
|
|
||||||
apt-get clean && \
|
apt-get clean && \
|
||||||
yarn cache clean
|
yarn cache clean
|
||||||
|
|
||||||
RUN yarn playwright install
|
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
RUN yarn prisma generate && \
|
RUN yarn prisma generate && \
|
||||||
|
|
Ŝarĝante…
Reference in New Issue