Skip to content

Commit

Permalink
fix: tweak of Dockerfile port arg handling
Browse files Browse the repository at this point in the history
  • Loading branch information
JesseKoldewijn committed Aug 15, 2023
1 parent 02d4c7a commit d3aec54
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ RUN NODE_ENV="production" pnpm build
# ? Production Stage
FROM node:lts-slim as Runner

# Get environment variable for app port with fallback to 3000
ARG PORT=3000

# Set environment variable for app port
ENV PORT=$PORT

# Set working directory
WORKDIR /app

Expand All @@ -52,8 +58,8 @@ COPY . .
# Copy builded app from builder stage
COPY --from=Builder /app/.next ./.next

# Expose port
EXPOSE 3000
# Expose port based on environment variable or ARG
EXPOSE $PORT

# Run app
CMD ["pnpm", "start"]
Expand Down

1 comment on commit d3aec54

@vercel
Copy link

@vercel vercel bot commented on d3aec54 Aug 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.