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+ # dependencies
2+ node_modules
3+ /.pnp
4+ .pnp.js
5+
6+ # testing
7+ /coverage
8+
9+ # next.js
10+ /.next /
11+ /out /
12+ /build
13+
14+ # misc
15+ .DS_Store
16+ * .pem
17+
18+ # debug
19+ npm-debug.log *
20+ yarn-debug.log *
21+ yarn-error.log *
22+
23+ # local env files
24+ .env.local
25+ .env.development.local
26+ .env.test.local
27+ .env.production.local
28+
29+ # vercel
30+ .vercel
31+
32+ # typescript
33+ * .tsbuildinfo
34+ next-env.d.ts
35+
36+ # Markdown
37+ * .md
Original file line number Diff line number Diff line change @@ -2,8 +2,6 @@ name: Digital Ocean deployment
22
33on :
44 push :
5- paths :
6- - ' backend/**'
75 branches :
86 - ' main'
97
@@ -14,21 +12,21 @@ jobs:
1412
1513 steps :
1614 - name : Checkout
17- uses : actions/checkout@v3
15+ uses : actions/checkout@v4
1816
1917 - name : Auth Docker
20- uses : docker/login-action@v2
18+ uses : docker/login-action@v3
2119 with :
2220 username : ${{ secrets.DOCKER_USERNAME }}
2321 password : ${{ secrets.DOCKER_PASSWORD }}
2422
2523 - name : Get SHA
2624 id : vars
27- run : echo "::set-output name= sha_short:: $(git rev-parse --short HEAD)"
25+ run : echo "sha_short= $(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
2826
2927 - name : Build
3028 run : |-
31- docker build --tag "cornellappdev/status-platform:${{ steps.vars.outputs.sha_short }}" ./backend/
29+ docker build --tag "cornellappdev/status-platform:${{ steps.vars.outputs.sha_short }}" .
3230
3331 - name : Publish
3432 run : |-
Original file line number Diff line number Diff line change 1+ FROM node:20-alpine AS base
2+
3+ # Step 1: Install dependencies
4+ FROM base AS deps
5+ RUN apk add --no-cache libc6-compat
6+ WORKDIR /app
7+
8+ # Copy package.json and lock file
9+ COPY package.json package-lock.json* ./
10+ # Install exact dependencies
11+ RUN npm ci
12+
13+ # Step 2: Build the application
14+ FROM base AS builder
15+ WORKDIR /app
16+ COPY --from=deps /app/node_modules ./node_modules
17+ COPY . .
18+
19+ # Disable Next.js telemetry during the build
20+ ENV NEXT_TELEMETRY_DISABLED=1
21+
22+ # Build the Next.js application
23+ RUN npm run build
24+
25+ # Step 3: Production image, copy all the files and run next
26+ FROM base AS runner
27+ WORKDIR /app
28+
29+ ENV NODE_ENV=production
30+ ENV NEXT_TELEMETRY_DISABLED=1
31+
32+ # Create unprivileged user for security
33+ RUN addgroup --system --gid 1001 nodejs
34+ RUN adduser --system --uid 1001 nextjs
35+
36+ # Copy essential files from builder
37+ COPY --from=builder /app/public ./public
38+ COPY --from=builder --chown=nextjs:nodejs /app/.next ./.next
39+ COPY --from=builder /app/node_modules ./node_modules
40+ COPY --from=builder /app/package.json ./package.json
41+
42+ USER nextjs
43+
44+ ENV PORT=3000
45+ ENV HOSTNAME="0.0.0.0"
46+
47+ # Start the Next.js application
48+ CMD ["npm" , "start" ]
You can’t perform that action at this time.
0 commit comments