Spaces:
Running
Running
Upload frontend.Dockerfile
Browse files- frontend.Dockerfile +26 -0
frontend.Dockerfile
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Stage 1: Build Stage
|
2 |
+
FROM node:22.9.0 AS build
|
3 |
+
|
4 |
+
WORKDIR /app
|
5 |
+
|
6 |
+
# Copy package.json and yarn.lock
|
7 |
+
COPY package.json ./
|
8 |
+
COPY yarn.lock ./
|
9 |
+
|
10 |
+
# Install dependencies
|
11 |
+
RUN yarn install --frozen-lockfile
|
12 |
+
|
13 |
+
# Copy source code
|
14 |
+
COPY . .
|
15 |
+
|
16 |
+
# Build the application
|
17 |
+
RUN yarn build
|
18 |
+
|
19 |
+
# Stage 2: Production Stage
|
20 |
+
FROM nginx:latest
|
21 |
+
|
22 |
+
# Copy built files from the build stage to the production image
|
23 |
+
COPY --from=build /app/dist /usr/share/nginx/html
|
24 |
+
|
25 |
+
# Container startup command for the web server (nginx in this case)
|
26 |
+
CMD ["nginx", "-g", "daemon off;"]
|