File tree Expand file tree Collapse file tree 4 files changed +72
-9
lines changed Expand file tree Collapse file tree 4 files changed +72
-9
lines changed Original file line number Diff line number Diff line change
1
+ node_modules
2
+ npm-debug.log
3
+ .DS_Store
4
+ .git
5
+ .gitignore
6
+ .env
Original file line number Diff line number Diff line change
1
+ name : Build Docker Image
2
+
3
+ on :
4
+ push :
5
+ branches : ["prod", "staging"]
6
+ pull_request :
7
+ branches : ["prod"]
8
+
9
+ permissions :
10
+ contents : read
11
+ packages : write
12
+
13
+ jobs :
14
+ build :
15
+ runs-on : ubuntu-latest
16
+ steps :
17
+ - name : Checkout code
18
+ uses : actions/checkout@v4
19
+
20
+ - name : Login to GitHub Container Registry
21
+ uses : docker/login-action@v1
22
+ with :
23
+ registry : ghcr.io
24
+ username : ${{ github.actor }}
25
+ password : ${{ secrets.GITHUB_TOKEN }}
26
+
27
+ - name : Build and Push Docker Image
28
+ run : |
29
+ docker build . --tag ghcr.io/upayanmazumder/papers-codechef:latest --build-arg NODE_ENV=production
30
+ docker push ghcr.io/upayanmazumder/papers-codechef:latest
Original file line number Diff line number Diff line change 1
1
# Step 1: Build stage
2
- FROM node:22-alpine AS builder
2
+ FROM node:23-alpine AS builder
3
+
4
+ # Install dependencies required for building native modules
5
+ RUN apk add --no-cache \
6
+ python3 \
7
+ make \
8
+ g++ \
9
+ pkgconfig \
10
+ pixman-dev \
11
+ cairo-dev \
12
+ pango-dev \
13
+ glib-dev \
14
+ jpeg-dev \
15
+ giflib-dev
16
+
17
+ # Install pnpm globally
18
+ RUN npm install -g pnpm
3
19
4
20
# Set the working directory
5
21
WORKDIR /app
6
22
7
- # Copy package.json and package -lock.json
8
- COPY package* .json ./
23
+ # Copy package.json and pnpm -lock.yaml
24
+ COPY package.json pnpm-lock.yaml ./
9
25
10
- # Install dependencies
11
- RUN npm install
26
+ # Install dependencies using pnpm
27
+ RUN pnpm install --frozen-lockfile
12
28
13
29
# Copy the rest of the application code
14
30
COPY . .
15
31
16
32
# Build the application
17
- RUN npm run build
33
+ RUN pnpm run build
18
34
19
35
# Step 2: Production stage
20
- FROM node:22-alpine
36
+ FROM node:23-alpine
37
+
38
+ # Install pnpm globally
39
+ RUN npm install -g pnpm
21
40
22
41
# Set the working directory
23
42
WORKDIR /app
24
43
44
+ # Set NODE_ENV to production
45
+ ENV NODE_ENV=production
46
+
25
47
# Copy only the built application and necessary files from the builder stage
26
- COPY --from=builder /app/package*.json ./
48
+ COPY --from=builder /app/package.json ./
49
+ COPY --from=builder /app/pnpm-lock.yaml ./
27
50
COPY --from=builder /app/node_modules ./node_modules
28
51
COPY --from=builder /app/.next ./.next
29
52
COPY --from=builder /app/public ./public
@@ -32,4 +55,4 @@ COPY --from=builder /app/public ./public
32
55
EXPOSE 3000
33
56
34
57
# Define the command to start the application
35
- CMD ["npm " , "start" ]
58
+ CMD ["pnpm " , "start" ]
Original file line number Diff line number Diff line change
1
+ services :
2
+ backend :
3
+ image : ghcr.io/upayanmazumder/papers-codechef:latest
4
+ build : .
You can’t perform that action at this time.
0 commit comments