aboutsummaryrefslogtreecommitdiff
path: root/Dockerfile
diff options
context:
space:
mode:
authorBobby <[email protected]>2022-11-30 23:16:07 -0500
committerBobby <[email protected]>2022-11-30 23:16:07 -0500
commitdaaa789068cebb5fdfcea6197ade6e663be46e0f (patch)
tree1cd315851b779ac28fe622da332c3c16fe1c433c /Dockerfile
downloadtcssocialify-daaa789068cebb5fdfcea6197ade6e663be46e0f.tar.xz
tcssocialify-daaa789068cebb5fdfcea6197ade6e663be46e0f.zip
socialify update
Diffstat (limited to 'Dockerfile')
-rw-r--r--Dockerfile43
1 files changed, 43 insertions, 0 deletions
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..b629d05
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,43 @@
+# Install dependencies only when needed
+FROM node:16-alpine AS builder
+# 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 . .
+RUN yarn install --frozen-lockfile
+
+# If using npm with a `package-lock.json` comment out above and use below instead
+# RUN npm ci
+
+ENV NEXT_TELEMETRY_DISABLED 1
+
+# Add `ARG` instructions below if you need `NEXT_PUBLIC_` variables
+# then put the value on your fly.toml
+# Example:
+# ARG NEXT_PUBLIC_EXAMPLE="value here"
+
+RUN yarn build
+
+# If using npm comment out above and use below instead
+# RUN npm run build
+
+# Production image, copy all the files and run next
+FROM node:16-alpine AS runner
+WORKDIR /app
+
+ENV NODE_ENV production
+ENV NEXT_TELEMETRY_DISABLED 1
+
+RUN addgroup --system --gid 1001 nodejs
+RUN adduser --system --uid 1001 nextjs
+
+COPY --from=builder /app ./
+
+USER nextjs
+
+ENV PORT 8080
+
+CMD ["yarn", "start"]
+
+# If using npm comment out above and use below instead
+# CMD ["npm", "run", "start"]