Skip to content

Commit

Permalink
feat: add deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
Fractal-Tess committed May 31, 2024
1 parent e2daddd commit c5476e8
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Deploy
on:
workflow_dispatch:
push:
branches:
- main

jobs:
deploy:
name: Build & deplo
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Compress
uses: a7ul/[email protected]
with:
command: c
files: ./
outPath: ./deploy.tar

- name: Deploy the tar to caprover
uses: caprover/deploy-from-github@main
with:
server: '${{ secrets.CAPROVER_SERVER }}'
app: '${{ secrets.APP_NAME }}'
token: '${{ secrets.APP_TOKEN }}'
40 changes: 40 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
FROM node:lts-alpine3.20 as base

FROM base AS builder

# RUN apk add --no-cache libc6-compat
# RUN apk update

WORKDIR /app

COPY . .

ENV BUILDING true

RUN npm install
RUN npm run build

FROM base AS runner
WORKDIR /app

COPY --from=builder /app/public ./public

RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs

RUN mkdir .next
RUN chown nextjs:nodejs .next

COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static

USER nextjs

ENV PORT 3000
ENV HOSTNAME 0.0.0.0
ENV NEXT_TELEMETRY_DISABLED 1
ENV NODE_ENV production

EXPOSE 3000

CMD ["node", "server.js"]
4 changes: 4 additions & 0 deletions captain-definition
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"schemaVersion": 2,
"dockerfilePath": "./Dockerfile"
}

0 comments on commit c5476e8

Please sign in to comment.