Skip to content

Commit b9272f9

Browse files
authored
add client dockerfile (#58)
1 parent f5c3d50 commit b9272f9

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

client/Dockerfile

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
FROM node:18.17.0-alpine as base
2+
3+
FROM base as deps
4+
RUN apk add --no-cache libc6-compat
5+
WORKDIR /app
6+
7+
COPY package.json /app
8+
COPY yarn.lock /app
9+
RUN --mount=type=secret,id=npmrc,target=/root/.npmrc yarn install
10+
11+
FROM base as builder
12+
WORKDIR /app
13+
COPY --from=deps /app/node_modules ./node_modules
14+
COPY . .
15+
16+
RUN yarn build
17+
18+
FROM base AS runner
19+
WORKDIR /app
20+
21+
RUN addgroup --system --gid 1001 nodejs
22+
RUN adduser --system --uid 1001 nextjs
23+
24+
COPY --from=builder /app/public ./public
25+
26+
RUN mkdir .next
27+
RUN chown nextjs:nodejs .next
28+
29+
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
30+
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
31+
32+
33+
USER nextjs
34+
35+
EXPOSE 3000
36+
ENV HOSTNAME "0.0.0.0"
37+
38+
CMD ["node", "server.js"]

client/next.config.js

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/** @type {import('next').NextConfig} */
22
const nextConfig = {
3+
output: 'standalone',
34
async rewrites() {
45
return [
56
{

0 commit comments

Comments
 (0)