-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
35 lines (24 loc) · 954 Bytes
/
Dockerfile
File metadata and controls
35 lines (24 loc) · 954 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Use an official Alpine Linux image as the base image
FROM alpine:latest
# Update package repositories and install necessary packages
RUN apk update && apk add --no-cache nodejs yarn
# Create a directory for the app
RUN mkdir -p /usr/src/app
# Set the working directory inside the container
WORKDIR /usr/src/app
# Copy the local application files to the container
COPY . .
# Create a non-root user for running the application
RUN adduser -D -g '' lifehax-lab
# Change ownership of the app directory to the non-root user
RUN chown -R lifehax-lab:lifehax-lab /usr/src/app
# Switch to the non-root user
USER lifehax-lab
# Install Node.js application dependencies using npm
RUN yarn install
# Build the application (modify this based on your project structure)
RUN yarn build
# Expose the port that your Next.js application will run on (change if necessary)
EXPOSE 3000
# Define the command to start your Next.js application
CMD ["yarn", "start"]