From f3a919e24fc5df6ea480bc0bc8121f4351415128 Mon Sep 17 00:00:00 2001 From: Daniel Kluge Date: Thu, 6 Jan 2022 20:21:37 +0100 Subject: [PATCH] Fix docker file for successfull build --- Dockerfile | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3aabb31..fe563c0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,21 @@ -FROM gatsbyjs/gatsby:onbuild as build +FROM node:alpine AS builder +RUN apk add --no-cache libc6-compat +WORKDIR /app +COPY package.json package-lock.json ./ +RUN npm ci +COPY . . +ENV GATSBY_TELEMETRY_DISABLED 1 +RUN npm run build -FROM gatsbyjs/gatsby -COPY --from=build /app/public /pub \ No newline at end of file +FROM node:alpine AS runner +WORKDIR /app +RUN addgroup -g 1001 -S gatsby +RUN adduser -S gatsby -u 1001 +COPY --from=builder /app/public ./public +COPY --from=builder /app/node_modules ./node_modules +COPY --from=builder /app/package.json ./package.json +USER gatsby +EXPOSE 9000 +ENV PORT 9000 +ENV GATSBY_TELEMETRY_DISABLED 1 +CMD ["node_modules/.bin/gatsby", "serve"] \ No newline at end of file