Skip to content

Commit fcc68f1

Browse files
authored
Initial version of actions (eu-digital-identity-wallet#5)
1 parent dc66478 commit fcc68f1

File tree

5 files changed

+141
-0
lines changed

5 files changed

+141
-0
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @eu-digital-identity-wallet/niscy-admins

.github/dependabot.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "npm"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
groups:
8+
libs:
9+
patterns:
10+
- "*"
11+
open-pull-requests-limit: 1
12+
- package-ecosystem: "github-actions"
13+
directory: "/"
14+
schedule:
15+
interval: "daily"
16+
groups:
17+
actions:
18+
patterns:
19+
- "*"
20+
open-pull-requests-limit: 1

.github/workflows/ci.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: CI
2+
on:
3+
pull_request:
4+
types: [opened, reopened, synchronize]
5+
push:
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
build-npm:
12+
name: Build
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout project sources
16+
uses: actions/checkout@v3
17+
- name: Setup Node.js
18+
uses: actions/setup-node@v2
19+
with:
20+
node-version: '22.20.0'
21+
- name: Install dependencies
22+
run: npm install
23+
- name: Generate prisma model
24+
run: npx prisma generate
25+
- name: Build
26+
run: npm run build
27+
28+
29+
30+
31+
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Publish to container registry
2+
3+
on:
4+
push:
5+
# Publish semver tags as releases.
6+
tags: [ 'v*.*.*' ]
7+
workflow_dispatch:
8+
9+
env:
10+
REGISTRY: ghcr.io
11+
IMAGE_NAME: ${{ github.repository }}
12+
13+
jobs:
14+
build:
15+
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: read
19+
packages: write
20+
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v3
24+
25+
# Set up BuildKit Docker container builder to be able to build
26+
# multi-platform images and export cache
27+
# https://github.com/docker/setup-buildx-action
28+
- name: Set up Docker Buildx
29+
uses: docker/setup-buildx-action@v3.0.0
30+
31+
# Login against a Docker registry except on PR
32+
# https://github.com/docker/login-action
33+
- name: Log into registry ${{ env.REGISTRY }}
34+
if: github.event_name != 'pull_request'
35+
uses: docker/login-action@v3.0.0
36+
with:
37+
registry: ${{ env.REGISTRY }}
38+
username: ${{ github.actor }}
39+
password: ${{ secrets.GITHUB_TOKEN }}
40+
41+
# Extract metadata (tags, labels) for Docker
42+
# https://github.com/docker/metadata-action
43+
- name: Extract Docker metadata
44+
id: meta
45+
uses: docker/metadata-action@v5.0.0
46+
with:
47+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
48+
49+
# Build and push Docker image with Buildx (don't push on PR)
50+
# https://github.com/docker/build-push-action
51+
- name: Build and push Docker image
52+
id: build-and-push
53+
uses: docker/build-push-action@v5.0.0
54+
with:
55+
context: .
56+
push: ${{ github.event_name != 'pull_request' }}
57+
tags: ${{ steps.meta.outputs.tags }}
58+
labels: ${{ steps.meta.outputs.labels }}
59+
cache-from: type=gha
60+
cache-to: type=gha,mode=max
61+
provenance: false

Dockerfile

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Stage 1: Install dependencies and build the Next.js app
2+
FROM node:22.20.0-alpine AS builder
3+
WORKDIR /app
4+
5+
# Install dependencies
6+
COPY package.json package-lock.json ./
7+
COPY prisma prisma ./
8+
RUN npm ci
9+
10+
# Copy the rest of the application code
11+
COPY . .
12+
#Initialize prisma
13+
RUN npx prisma generate
14+
# Build the Next.js application
15+
RUN npm run build
16+
17+
# Stage 2: Set up the production environment with Nginx
18+
FROM node:22.20.0-alpine
19+
WORKDIR /app
20+
21+
# Copy the built Next.js app and dependencies
22+
COPY --from=builder /app/.next ./.next
23+
COPY --from=builder /app/public ./public
24+
COPY --from=builder /app/package.json ./package.json
25+
COPY --from=builder /app/node_modules ./node_modules
26+
27+
# Start the Next.js app and Nginx
28+
CMD ["npm", "start"]

0 commit comments

Comments
 (0)