From 303d2185706c3c809e93bb6d2e0411cbe0a06478 Mon Sep 17 00:00:00 2001 From: Adrien le Maire Date: Tue, 2 Mar 2021 12:33:32 +0000 Subject: [PATCH] Update shields/Makefile, shields/Dockerfile files --- shields/Dockerfile | 23 +++++++++++++++++++++++ shields/Makefile | 5 +++-- 2 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 shields/Dockerfile diff --git a/shields/Dockerfile b/shields/Dockerfile new file mode 100644 index 0000000..3870845 --- /dev/null +++ b/shields/Dockerfile @@ -0,0 +1,23 @@ +FROM node:14.16.0-alpine3.13 + +RUN mkdir -p /usr/src/app/private +WORKDIR /usr/src/app + +COPY package.json package-lock.json /usr/src/app/ +# Without the badge-maker package.json and CLI script in place, `npm ci` will fail. +COPY badge-maker /usr/src/app/badge-maker/ + +# We need dev deps to build the front end. We don't need Cypress, though. +RUN NODE_ENV=development CYPRESS_INSTALL_BINARY=0 npm ci + +COPY . /usr/src/app +RUN npm run build && \ + npm prune --production && \ + npm cache clean --force + +# Run the server using production configs. +ENV NODE_ENV production + +CMD node server + +EXPOSE 80 diff --git a/shields/Makefile b/shields/Makefile index 0ae26e3..b78a901 100644 --- a/shields/Makefile +++ b/shields/Makefile @@ -13,7 +13,8 @@ decompress: build: docker buildx build --platform linux/amd64,linux/arm64 --push \ - --cache-from=type=registry,ref=${NAMESPACE}/buildx:${IMAGE} \ + --cache-from=type=registry,ref=${NAMESPACE}/buildx:${IMAGE} \ --cache-to=type=registry,ref=${NAMESPACE}/buildx:${IMAGE} \ --tag ${NAMESPACE}/${IMAGE}:$(VERSION) \ - --tag ${CI_REGISTRY_IMAGE}/${IMAGE}:$(VERSION) shields-$(VERSION) + --tag ${CI_REGISTRY_IMAGE}/${IMAGE}:$(VERSION) \ + --file Dockerfile shields-$(VERSION)