forked from electh/nextflux
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
33 lines (23 loc) · 782 Bytes
/
Dockerfile
File metadata and controls
33 lines (23 loc) · 782 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
# Stage 1: Build the React application
# Specify the version to ensure consistent builds
FROM node:22-alpine AS build
# Set the working directory in the container
WORKDIR /app
# Copy the package.json and package-lock.json files
COPY package.json package-lock.json ./
# Install dependencies using npm
RUN npm ci
# Copy the rest of the code
COPY . .
# Build the project
RUN npm run build
# Stage 2: Run the server using Caddy
# Specify the version for consistency
FROM caddy:2-alpine
# Copy built assets from the builder stage
COPY --from=build /app/dist /srv
# Caddy will pick up the Caddyfile automatically
COPY Caddyfile /etc/caddy/Caddyfile
# Expose the port Caddy listens on
EXPOSE 3000
CMD ["caddy", "run", "--config", "/etc/caddy/Caddyfile", "--adapter", "caddyfile"]