Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FirstMate's changes for - Example PR: Docker file changes #45

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 24 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,30 @@
FROM node:19-alpine
ENV PORT 8080
# Stage 1: Build Stage
FROM node:14-alpine AS build

WORKDIR /usr/src/app

RUN apk add --no-cache git
# Install dependencies
COPY package*.json ./
RUN npm install

# Copy the rest of the application files
COPY . .

# Stage 2: Final Stage
FROM node:14-alpine

WORKDIR /usr/src/app

# Copy built files from the build stage
COPY --from=build /usr/src/app .

# Create a non-root user
RUN addgroup -S appgroup && adduser -S appuser -G appgroup

# Switch to the non-root user
USER appuser

ENV PORT 8080
EXPOSE 8080

CMD ["npm", "start", "--no-update-notifier"]
Loading