Skip to content

Commit

Permalink
improvements and fixes: clean up Dockerfile and .dockerignore for bet…
Browse files Browse the repository at this point in the history
…ter build efficiency and user management
  • Loading branch information
LeonardoMeireles55 committed Feb 5, 2025
1 parent 2a8d1fa commit 10c4aa4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 27 deletions.
10 changes: 0 additions & 10 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@ yarn-error.log*
/coverage
/test-results

# Next.js
/.next/
/out/
/build

# Environment files
.env.local
.env.development.local
Expand Down Expand Up @@ -41,11 +36,6 @@ docker-compose.yml
.DS_Store
Thumbs.db

# Documentation and config
*.md
*.yml
*.yaml

# Misc
.log
/dist
24 changes: 7 additions & 17 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,12 @@ 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/public ./public
# COPY --from=builder /app/.next ./_next
# COPY --from=builder /app/.next/standalone ./
# COPY --from=builder /app/.next/static ./.next/static

COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static
COPY --from=builder /app/.next/static ./.next/standalone/.next/static
COPY --from=builder /app/public ./
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs

COPY --from=builder /app/public ./public
COPY --from=builder /app/.next/server ./.next/standalone/server
COPY --from=builder /app/.next/cache ./.next/standalone/cache
COPY --from=builder /app/.next/static ./_next/static
COPY --from=builder /app/.next ./_next
# COPY --chown=nextjs:nodejs --from=builder /app/.next ./_next
COPY --chown=nextjs:nodejs --from=builder /app/.next/standalone ./
COPY --chown=nextjs:nodejs --from=builder /app/.next/static ./.next/static

# USER nextjs
USER nextjs

0 comments on commit 10c4aa4

Please sign in to comment.