Skip to content

Feat/test ci #27

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Apr 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 83 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: CI
on:
push:
branches: [master, dev]
pull_request:
branches: [master, dev]

jobs:
lint:
runs-on: self-hosted
strategy:
matrix:
node-version: [18]
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v4
with:
version: 9
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- run: pnpm install --frozen-lockfile
- run: pnpm lint

deploy-dev:
if: ${{ github.event_name != 'pull_request' && (github.ref == 'refs/heads/dev') }}
runs-on: self-hosted
needs:
- lint
steps:
- uses: actions/checkout@v4
- name: Install docker
uses: docker/setup-buildx-action@v3
- name: Login to registry
uses: docker/login-action@v3
with:
registry: ${{ secrets.REGISTRY_URL }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_TOKEN }}
- run: cp .env.dist .env.prod
- name: Build and push
uses: docker/build-push-action@v6
with:
push: true
build-args: |
NODE_ENV=production
NEXT_PUBLIC_API_URL=https://etu.dev.uttnetgroup.fr/api
NEXT_PUBLIC_CAS_SERVICE_URL=https://etu.dev.uttnetgroup.fr/login
NEXT_PUBLIC_API_VERSION=v1
NEXT_PUBLIC_API_REQUEST_TIMEOUT=5000
tags: |
${{ secrets.REGISTRY_URL }}/etuutt/front:dev

deploy-prod:
if: ${{ github.event_name != 'pull_request' && (github.ref == 'refs/heads/master') }}
runs-on: self-hosted
needs:
- lint
steps:
- uses: actions/checkout@v4
- name: Install docker
uses: docker/setup-buildx-action@v3
- name: Login to registry
uses: docker/login-action@v3
with:
registry: ${{ secrets.REGISTRY_URL }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_TOKEN }}
- run: cp .env.dist .env.prod
- name: Build and push
uses: docker/build-push-action@v6
with:
push: true
build-args: |
NODE_ENV=production
NEXT_PUBLIC_API_URL=https://etu.utt.fr/api
NEXT_PUBLIC_CAS_SERVICE_URL=https://etu.utt.fr/login
NEXT_PUBLIC_API_VERSION=v1
NEXT_PUBLIC_API_REQUEST_TIMEOUT=5000
tags: |
${{ secrets.REGISTRY_URL }}/etuutt/front:prod
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
ARG NODE_VERSION=19-alpine
ARG NODE_VERSION=22-alpine

FROM node:${NODE_VERSION}

WORKDIR /usr/src/app

# Add alpine dependencies for 'sharp'
RUN apk add --upgrade --no-cache vips-dev build-base

COPY --chown=node:node package.json pnpm-lock.yaml ./

RUN npm i -g pnpm && pnpm install --frozen-lockfile --prod=false
Expand Down
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,10 @@
"eslint-plugin-react": "^7.34.2",
"sass": "^1.77.4",
"typescript": "^5.4.5"
},
"pnpm": {
"onlyBuiltDependencies": [
"sharp"
]
}
}