From 76969b0da16950e674ed4a5e26ca316f38c41270 Mon Sep 17 00:00:00 2001 From: Michael Schramm Date: Tue, 16 Jun 2020 10:45:52 +0200 Subject: [PATCH] reduce docker layer size --- CHANGELOG.md | 6 ++++++ Dockerfile | 12 ++++++++++++ 2 files changed, 18 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9099b4c..0210410 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] ### Added + +- default index.html for api without bundled ui + ### Changed + +- minify containers to reduce layer size + ### Fixed - bug in settings resolver with nullable fields diff --git a/Dockerfile b/Dockerfile index d854d98..0a58cdf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,6 +3,11 @@ MAINTAINER OhMyForm WORKDIR /usr/src/app +RUN apk update && apk add curl bash && rm -rf /var/cache/apk/* + +# install node-prune (https://github.com/tj/node-prune) +RUN curl -sfL https://install.goreleaser.com/github.com/tj/node-prune.sh | bash -s -- -b /usr/local/bin + # just copy everhing COPY . . @@ -11,6 +16,12 @@ RUN touch /usr/src/app/src/schema.gql && chown 9999:9999 /usr/src/app/src/schema RUN yarn install --frozen-lockfile RUN yarn build +# remove development dependencies +RUN npm prune --production + +# run node prune +RUN /usr/local/bin/node-prune + FROM node:12-alpine MAINTAINER OhMyForm @@ -28,6 +39,7 @@ ENV PORT=3000 \ ADMIN_USERNAME=root \ ADMIN_PASSWORD=root + EXPOSE 3000 # Change to non-root privilege