Skip to content

Commit 7eebb4f

Browse files
committed
feat(Dockerfiles): streamline build processes and update image references for backend and frontend
1 parent ac2889b commit 7eebb4f

3 files changed

Lines changed: 6 additions & 25 deletions

File tree

backend/Dockerfile

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,11 @@
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
85
COPY 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
148
COPY . .
159

16-
# Step 6: Expose the port the app runs on
1710
EXPOSE 3000
18-
19-
# Step 7: Command to run the app
2011
CMD ["npm", "start"]

docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff 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:

frontend/Dockerfile

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,13 @@
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
53
WORKDIR /app
64

7-
# Step 3: Copy package.json and package-lock.json
85
COPY 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
148
COPY . .
15-
16-
# Step 6: Pass Vite env at build time
179
ARG VITE_API_BASE_URL=
1810
ENV VITE_API_BASE_URL=$VITE_API_BASE_URL
19-
20-
# Step 7: Build the React app for production
2111
RUN 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
2717
COPY nginx.conf /etc/nginx/nginx.conf
2818

2919
EXPOSE 80
30-
3120
CMD ["nginx", "-g", "daemon off;"]

0 commit comments

Comments
 (0)