chore: add ci
Some checks are pending
Build and Publish Docker Image / docker (push) Waiting to run

This commit is contained in:
Nathan Lamy 2025-08-21 16:06:54 +02:00
parent f39a0be9f0
commit 0164870be5
3 changed files with 72 additions and 8239 deletions

View file

@ -0,0 +1,42 @@
name: Build and Publish Docker Image
on:
push:
branches: ["main"]
jobs:
docker:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=ref,event=branch
type=ref,event=tag
type=sha
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

30
Dockerfile Normal file
View file

@ -0,0 +1,30 @@
ARG NODE_IMAGE=node:22-slim
###### First Stage - Creating base ######
FROM $NODE_IMAGE as base
RUN mkdir -p /home/node/app && chown node:node /home/node/app
RUN npm install --global pnpm
WORKDIR /home/node/app
USER node
RUN mkdir tmp
###### Second Stage - Installing dependencies ######
FROM base AS dependencies
COPY --chown=node:node ./package*.json ./
RUN pnpm install
COPY --chown=node:node . .
###### Third Stage - Building Stage ######
FROM dependencies AS build
RUN node ace build
###### Final Stage - Production ######
FROM base as production
ENV NODE_ENV=production
ENV PORT=3333
ENV HOST=0.0.0.0
COPY --chown=node:node ./package.json ./
COPY --chown=node:node ./pnpm-lock.yaml ./
RUN pnpm install --prod
COPY --chown=node:node --from=build /home/node/app/build .
EXPOSE 3333

8239
package-lock.json generated

File diff suppressed because it is too large Load diff