File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Load diff This file was deleted.
Load diff This file was deleted.
Load diff This file was deleted.
Original file line number Diff line number Diff line change 1+ name : Deploy to Development
2+
3+ on :
4+ push :
5+ branches :
6+ - chore/#142-cicd-migration
7+
8+ env :
9+ DOCKER_IMAGE : ${{ secrets.DOCKER_USERNAME }}/billilge-client
10+ CAPROVER_APP : dev
11+
12+ jobs :
13+ build-and-deploy :
14+ runs-on : ubuntu-latest
15+ environment : development
16+
17+ steps :
18+ - name : Checkout
19+ uses : actions/checkout@v4
20+
21+ - name : Create .env file
22+ run : echo "${{ secrets.DEV_ENV_FILE }}" > .env.production
23+
24+ - name : Set up Docker Buildx
25+ uses : docker/setup-buildx-action@v3
26+
27+ - name : Login to Docker Hub
28+ uses : docker/login-action@v3
29+ with :
30+ username : ${{ secrets.DOCKER_USERNAME }}
31+ password : ${{ secrets.DOCKER_PASSWORD }}
32+
33+ - name : Build and Push
34+ uses : docker/build-push-action@v5
35+ with :
36+ context : .
37+ push : true
38+ tags : |
39+ ${{ env.DOCKER_IMAGE }}:dev
40+ ${{ env.DOCKER_IMAGE }}:dev-${{ github.sha }}
41+ cache-from : type=gha,scope=dev
42+ cache-to : type=gha,mode=max,scope=dev
43+
44+ - name : Deploy to CapRover
45+ uses : caprover/deploy-from-github@v1.1.2
46+ with :
47+ server : ${{ secrets.CAPROVER_SERVER }}
48+ app : ${{ env.CAPROVER_APP }}
49+ token : ${{ secrets.CAPROVER_DEV_APP_TOKEN }}
50+ image : ${{ env.DOCKER_IMAGE }}:dev
Original file line number Diff line number Diff line change 1+ name : Deploy to Production
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+
8+ env :
9+ DOCKER_IMAGE : ${{ secrets.DOCKER_USERNAME }}/billilge-client
10+ CAPROVER_APP : app
11+
12+ jobs :
13+ build-and-deploy :
14+ runs-on : ubuntu-latest
15+ environment : production
16+
17+ steps :
18+ - name : Checkout
19+ uses : actions/checkout@v4
20+
21+ - name : Create .env file
22+ run : echo "${{ secrets.PROD_ENV_FILE }}" > .env.production
23+
24+ - name : Set up Docker Buildx
25+ uses : docker/setup-buildx-action@v3
26+
27+ - name : Login to Docker Hub
28+ uses : docker/login-action@v3
29+ with :
30+ username : ${{ secrets.DOCKER_USERNAME }}
31+ password : ${{ secrets.DOCKER_PASSWORD }}
32+
33+ - name : Build and Push
34+ uses : docker/build-push-action@v5
35+ with :
36+ context : .
37+ push : true
38+ tags : |
39+ ${{ env.DOCKER_IMAGE }}:prod
40+ ${{ env.DOCKER_IMAGE }}:prod-${{ github.sha }}
41+ ${{ env.DOCKER_IMAGE }}:latest
42+ cache-from : type=gha,scope=prod
43+ cache-to : type=gha,mode=max,scope=prod
44+
45+ - name : Deploy to CapRover
46+ uses : caprover/deploy-from-github@v1.1.2
47+ with :
48+ server : ${{ secrets.CAPROVER_SERVER }}
49+ app : ${{ env.CAPROVER_APP }}
50+ token : ${{ secrets.CAPROVER_PROD_APP_TOKEN }}
51+ image : ${{ env.DOCKER_IMAGE }}:prod
Original file line number Diff line number Diff line change 1+ # Build stage
2+ FROM node:20-alpine AS builder
3+ WORKDIR /app
4+
5+ COPY package.json yarn.lock ./
6+ RUN yarn install --frozen-lockfile
7+
8+ COPY . .
9+ RUN yarn build
10+
11+ # Production stage
12+ FROM node:20-alpine AS runner
13+ WORKDIR /app
14+
15+ ENV NODE_ENV=production
16+
17+ RUN addgroup --system --gid 1001 nodejs
18+ RUN adduser --system --uid 1001 nextjs
19+
20+ COPY --from=builder /app/public ./public
21+ COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
22+ COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
23+
24+ USER nextjs
25+
26+ EXPOSE 3000
27+ ENV PORT=3000
28+ ENV HOSTNAME="0.0.0.0"
29+
30+ CMD ["node" , "server.js" ]
You can’t perform that action at this time.
0 commit comments