diff options
| author | Jan Tuomi <jans.tuomi@gmail.com> | 2021-06-30 13:24:28 +0300 |
|---|---|---|
| committer | Jan Tuomi <jans.tuomi@gmail.com> | 2021-06-30 13:24:28 +0300 |
| commit | 752b96afdf2fa285492deaf3a676d2b2c2e47c9f (patch) | |
| tree | 2f871d262bd2ef87d52e30737b5ead2fc2cd738e /frontend/Dockerfile | |
| parent | f021b52028f5965516671b7f53e7e71543a8ae52 (diff) | |
Dockerize
Diffstat (limited to 'frontend/Dockerfile')
| -rw-r--r-- | frontend/Dockerfile | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/frontend/Dockerfile b/frontend/Dockerfile new file mode 100644 index 0000000..2a22355 --- /dev/null +++ b/frontend/Dockerfile @@ -0,0 +1,27 @@ +# Install dependencies only when needed +FROM node:alpine AS deps +# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed. +RUN apk add --no-cache libc6-compat +WORKDIR /app +COPY package.json package-lock.json ./ +RUN npm ci --only-prod + +# Rebuild the source code only when needed +FROM node:alpine AS builder + +ENV NODE_ENV production +ENV NEXT_TELEMETRY_DISABLED 1 +ARG NEXT_PUBLIC_BACKEND_URL + +WORKDIR /app +COPY . . +COPY --from=deps /app/node_modules ./node_modules +RUN printenv > .env.local +RUN npm run build && npm run export + +# Production image, copy all the files and run next +FROM sebp/lighttpd:latest AS runner + +WORKDIR /var/www/localhost/htdocs + +COPY --from=builder /app/out ./ |
