Moved examples together
This commit is contained in:
68
examples/deploy.yml
Normal file
68
examples/deploy.yml
Normal file
@@ -0,0 +1,68 @@
|
||||
name: Deploy
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ["main", "**"]
|
||||
delete:
|
||||
|
||||
env:
|
||||
PANGOLIN_API_URL: ${{ secrets.PANGOLIN_API_URL }}
|
||||
PANGOLIN_API_KEY: ${{ secrets.PANGOLIN_API_KEY }}
|
||||
PANGOLIN_ORG_ID: ${{ secrets.PANGOLIN_ORG_ID }}
|
||||
PANGOLIN_DOMAIN_ID: ${{ secrets.PANGOLIN_DOMAIN_ID }}
|
||||
PANGOLIN_SITE_ID: ${{ secrets.PANGOLIN_SITE_ID }}
|
||||
PANGOLIN_TARGET_IP: ${{ secrets.PANGOLIN_TARGET_IP }}
|
||||
|
||||
jobs:
|
||||
deploy-production:
|
||||
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: eighty-six/node-deploy-action/deploy@v1
|
||||
with:
|
||||
app-name: ${{ vars.APP_NAME }}
|
||||
tag: production
|
||||
port: ${{ vars.PROD_PORT }}
|
||||
environment: production
|
||||
subdomain: ${{ vars.PROD_SUBDOMAIN }}
|
||||
|
||||
deploy-preview:
|
||||
if: github.event_name == 'push' && github.ref != 'refs/heads/main'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Compute preview slug
|
||||
id: slug
|
||||
uses: eighty-six/node-deploy-action/slug@v1
|
||||
with:
|
||||
branch: ${{ github.ref_name }}
|
||||
|
||||
- uses: eighty-six/node-deploy-action/deploy@v1
|
||||
with:
|
||||
app-name: ${{ vars.APP_NAME }}
|
||||
tag: ${{ steps.slug.outputs.slug }}
|
||||
port: ${{ steps.slug.outputs.port }}
|
||||
environment: preview
|
||||
subdomain: ${{ steps.slug.outputs.slug }}.${{ vars.APP_NAME }}
|
||||
|
||||
cleanup-preview:
|
||||
if: github.event_name == 'delete' && github.event.ref_type == 'branch'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Compute preview slug
|
||||
id: slug
|
||||
uses: eighty-six/node-deploy-action/slug@v1
|
||||
with:
|
||||
branch: ${{ github.event.ref }}
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: main
|
||||
|
||||
- uses: eighty-six/node-deploy-action/cleanup@v1
|
||||
with:
|
||||
app-name: ${{ vars.APP_NAME }}
|
||||
slug: ${{ steps.slug.outputs.slug }}
|
||||
38
examples/docker/next.dockerfile
Normal file
38
examples/docker/next.dockerfile
Normal file
@@ -0,0 +1,38 @@
|
||||
# === Stage 1: deps ===
|
||||
FROM node:20-alpine AS deps
|
||||
WORKDIR /app
|
||||
|
||||
COPY package.json package-lock.json* yarn.lock* pnpm-lock.yaml* ./
|
||||
RUN \
|
||||
if [ -f yarn.lock ]; then yarn install --frozen-lockfile; \
|
||||
elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm install --frozen-lockfile; \
|
||||
else npm ci; \
|
||||
fi
|
||||
|
||||
# === Stage 2: build ===
|
||||
FROM node:20-alpine AS builder
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=deps /app/node_modules ./node_modules
|
||||
COPY . .
|
||||
|
||||
ARG APP_ENV=production
|
||||
ENV NEXT_PUBLIC_APP_ENV=$APP_ENV
|
||||
|
||||
RUN npm run build
|
||||
|
||||
# === Stage 3: runner ===
|
||||
FROM node:20-alpine AS runner
|
||||
WORKDIR /app
|
||||
|
||||
ENV NODE_ENV=production
|
||||
|
||||
COPY --from=builder /app/public ./public
|
||||
COPY --from=builder /app/.next/standalone ./
|
||||
COPY --from=builder /app/.next/static ./.next/static
|
||||
|
||||
EXPOSE 3000
|
||||
ENV PORT=3000
|
||||
ENV HOSTNAME="0.0.0.0"
|
||||
|
||||
CMD ["node", "server.js"]
|
||||
Reference in New Issue
Block a user