From 2fbb753c1eb715b31034f5ce851f6abceaeb9309 Mon Sep 17 00:00:00 2001 From: Raphael Kabo Date: Wed, 31 Jul 2024 22:45:39 +0100 Subject: Add GitHub CI files to publish Docker container --- Dockerfile | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'Dockerfile') diff --git a/Dockerfile b/Dockerfile index 5da290e..61947a8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,6 @@ -FROM node:20-alpine +# Docker builds hang in arm/v7 images, so we use Node 18 to build and Node 20 to run +# Cf. https://github.com/docker/build-push-action/issues/1071 +FROM node:18-alpine AS BUILD_IMAGE WORKDIR /app RUN apk add --no-cache python3 build-base ADD package.json pnpm-lock.yaml /app/ @@ -8,4 +10,10 @@ COPY . /app/ # Always exit 0 here because TSC will fail while we're migrating to TypeScript but # not everything uses TypeScript RUN pnpm run build; exit 0 + +# Now we run the app +FROM node:20-alpine +ENV NODE_ENV=production +WORKDIR /app +COPY --from=BUILD_IMAGE /app ./ CMD ["node", "dist/start.js"] -- cgit v1.2.3