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+ name : Deploy to Internal Server
2+
3+ on :
4+ push :
5+ branches :
6+ - develop
7+
8+ env :
9+ DOCKER_IMAGE : ${{ secrets.DOCKER_USERNAME }}/billilge-admin
10+ CAPROVER_APP : admin
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.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 --ignore-scripts
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" ]
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import type { NextConfig } from "next";
22
33const nextConfig : NextConfig = {
44 /* config options here */
5+ output : 'standalone'
56} ;
67
78export default nextConfig ;
You can’t perform that action at this time.
0 commit comments