From 297228692c7f692f059d7988d76c56578626e9fb Mon Sep 17 00:00:00 2001 From: Max Isom Date: Sat, 26 Mar 2022 12:33:56 -0400 Subject: [PATCH] Reduce image size --- CHANGELOG.md | 2 ++ Dockerfile | 23 +++++++---------------- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9096999..c0177cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Changed +- Reduced image size ## [1.8.0] - 2022-03-24 ### Added diff --git a/Dockerfile b/Dockerfile index 21ceac1..0885308 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,36 +5,27 @@ RUN apt-get update && \ apt-get install -y ffmpeg && \ rm -rf /var/lib/apt/lists/* +# Install dependencies +FROM base AS dependencies + WORKDIR /usr/app COPY package.json . COPY yarn.lock . -# Install prod dependencies RUN yarn install --prod -# Dependencies -FROM base AS dependencies +# Only keep what's necessary to run +FROM base AS runner -# Install dev dependencies -RUN yarn install +WORKDIR /usr/app -# Build app -FROM dependencies AS builder +COPY --from=dependencies /usr/app/node_modules node_modules COPY . . RUN yarn prisma generate -# Only copy essentials -FROM base AS prod - -COPY --from=builder /usr/app/src src -COPY --from=builder /usr/app/schema.prisma . -COPY --from=builder /usr/app/migrations migrations - -RUN yarn prisma generate - ARG COMMIT_HASH=unknown ENV DATA_DIR /data