reduce docker layer size

This commit is contained in:
Michael Schramm 2020-06-16 10:45:52 +02:00
parent 99fd0b4dc7
commit 76969b0da1
2 changed files with 18 additions and 0 deletions

View File

@ -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

View File

@ -3,6 +3,11 @@ MAINTAINER OhMyForm <admin@ohmyform.com>
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 <admin@ohmyform.com>
@ -28,6 +39,7 @@ ENV PORT=3000 \
ADMIN_USERNAME=root \
ADMIN_PASSWORD=root
EXPOSE 3000
# Change to non-root privilege