File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- # Step 1: Use the official Node.js image
2- FROM node:18
1+ FROM node:18-alpine
32
4- # Step 2: Set working directory inside the container
5- WORKDIR /usr/src/app
3+ WORKDIR /app
64
7- # Step 3: Copy package.json and package-lock.json
85COPY package*.json ./
6+ RUN npm ci --only=production
97
10- # Step 4: Install dependencies
11- RUN npm install
12-
13- # Step 5: Copy the rest of the app's source code
148COPY . .
159
16- # Step 6: Expose the port the app runs on
1710EXPOSE 3000
18-
19- # Step 7: Command to run the app
2011CMD ["npm" , "start" ]
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ services:
2929 - task-board-network
3030
3131 frontend :
32+ image : ghcr.io/tesfa27/task-board:frontend-latest
3233 build :
3334 context : ./frontend
3435 args :
Original file line number Diff line number Diff line change 1- # Step 1: Use the official Node.js image
2- FROM node:18 AS build
1+ FROM node:18-alpine AS build
32
4- # Step 2: Set working directory inside the container
53WORKDIR /app
64
7- # Step 3: Copy package.json and package-lock.json
85COPY package*.json ./
6+ RUN npm ci --only=production
97
10- # Step 4: Install dependencies
11- RUN npm install
12-
13- # Step 5: Copy the rest of the app's source code
148COPY . .
15-
16- # Step 6: Pass Vite env at build time
179ARG VITE_API_BASE_URL=
1810ENV VITE_API_BASE_URL=$VITE_API_BASE_URL
19-
20- # Step 7: Build the React app for production
2111RUN npm run build
2212
2313# Step 8: Use Nginx to serve the built app
@@ -27,5 +17,4 @@ COPY --from=build /app/dist /usr/share/nginx/html
2717COPY nginx.conf /etc/nginx/nginx.conf
2818
2919EXPOSE 80
30-
3120CMD ["nginx" , "-g" , "daemon off;" ]
You can’t perform that action at this time.
0 commit comments