Skip to content

Commit

Permalink
podman dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
Rudolf Pailer committed Nov 12, 2023
2 parents e09c843 + 2ad1cec commit 342a14b
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
42 changes: 42 additions & 0 deletions Dockerfile_alpine
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# 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=1.2.3-r4
WORKDIR /app
COPY package.json ./
RUN npm install

# Rebuild the source code only when needed
FROM node:alpine AS builder
WORKDIR /app
COPY . .
COPY --from=deps /app/node_modules ./node_modules
RUN export NODE_OPTIONS=--openssl-legacy-provider && npm run build

# Production image, copy all the files and run next
FROM node:alpine AS runner
WORKDIR /app

ENV NODE_ENV production

RUN addgroup -g 1001 -S nodejs
RUN adduser -S nextjs -u 1001

# You only need to copy next.config.js if you are NOT using the default configuration
# COPY --from=builder /app/next.config.js ./
COPY --from=builder /app/public ./public
COPY --from=builder --chown=nextjs:nodejs /app/.next ./.next
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package.json ./package.json

USER nextjs

EXPOSE 3000

# Next.js collects completely anonymous telemetry data about general usage.
# Learn more here: https://nextjs.org/telemetry
# Uncomment the following line in case you want to disable telemetry.
# ENV NEXT_TELEMETRY_DISABLED 1

CMD ["npm", "start"]

2 changes: 1 addition & 1 deletion pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export default function Home(todos) {
let todo = {
_id: uuidv4(),
text: input,
fsinished: false,
finished: false,
}
let response = await fetch('/api/' + storePath, {
method: 'POST',
Expand Down

0 comments on commit 342a14b

Please sign in to comment.