feat: Add a multi-stage Dockerfile for building and running the frontend application.
This commit is contained in:
parent
7fcebadb7c
commit
b24988d8bc
1 changed files with 4 additions and 11 deletions
|
|
@ -29,18 +29,11 @@ WORKDIR /app
|
|||
# Set environment to production
|
||||
ENV NODE_ENV=production
|
||||
|
||||
# Create non-root user for security
|
||||
RUN addgroup --system --gid 1001 nodejs \
|
||||
&& adduser --system --uid 1001 nuxtjs
|
||||
|
||||
# Copy package files for preview command
|
||||
COPY --from=builder --chown=nuxtjs:nodejs /app/package*.json ./
|
||||
COPY --from=builder --chown=nuxtjs:nodejs /app/node_modules ./node_modules
|
||||
COPY --from=builder --chown=nuxtjs:nodejs /app/.nuxt ./.nuxt
|
||||
COPY --from=builder --chown=nuxtjs:nodejs /app/.output ./.output
|
||||
|
||||
# Switch to non-root user
|
||||
USER nuxtjs
|
||||
COPY --from=builder /app/package*.json ./
|
||||
COPY --from=builder /app/node_modules ./node_modules
|
||||
COPY --from=builder /app/.nuxt ./.nuxt
|
||||
COPY --from=builder /app/.output ./.output
|
||||
|
||||
# Expose port
|
||||
EXPOSE 3001
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue