-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci(github): publish docker image (#47)
- Loading branch information
1 parent
cc00218
commit e218d2b
Showing
7 changed files
with
117 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# | ||
* | ||
|
||
# | ||
!**/package.json | ||
!/back/nest-cli.json | ||
!/back/src | ||
!/back/tsconfig.build.json | ||
!/back/tsconfig.json | ||
!/front/index.html | ||
!/front/public/.gitkeep | ||
!/front/src | ||
!/front/tsconfig.json | ||
!/front/tsconfig.node.json | ||
!/front/vite.config.ts | ||
!/package-lock.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# | ||
|
||
name: Publish | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- alpha | ||
|
||
workflow_dispatch: | ||
|
||
permissions: | ||
packages: write | ||
|
||
jobs: | ||
build: | ||
name: Publich Docker Image | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to Github Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ github.token }} | ||
|
||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ghcr.io/betagouv/espace-partenaire | ||
tags: | | ||
type=sha,format=long,prefix= | ||
type=ref,event=branch | ||
type=ref,event=tag | ||
flavor: | | ||
latest=${{ github.ref == 'refs/heads/main' }} | ||
- uses: actions/checkout@v4 | ||
- name: Build image | ||
uses: docker/build-push-action@v3 | ||
with: | ||
build-args: | | ||
SOURCE_COMMIT=${{ github.sha }} | ||
cache-from: type=registry,ref=ghcr.io/${{ github.repository }}:buildcache | ||
cache-to: type=registry,ref=ghcr.io/${{ github.repository }}:buildcache,mode=max | ||
labels: ${{ steps.meta.outputs.labels }} | ||
platforms: linux/amd64 | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# | ||
|
||
FROM node:lts-buster-slim as base | ||
|
||
ENV TZ Europe/Paris | ||
RUN cp /usr/share/zoneinfo/Europe/Paris /etc/localtime | ||
|
||
RUN --mount=type=cache,target=/root/.npm,sharing=locked \ | ||
npm install -g npm@latest | ||
|
||
WORKDIR /home/node/app | ||
|
||
COPY ./package.json ./ | ||
COPY ./back/package.json ./back/ | ||
COPY ./front/package.json ./front/ | ||
COPY ./front/public/ ./front/public/ | ||
|
||
RUN --mount=type=cache,target=/root/.npm,sharing=locked \ | ||
npm install --omit=dev | ||
|
||
# | ||
|
||
FROM base AS build | ||
|
||
RUN --mount=type=cache,target=/root/.npm,sharing=locked \ | ||
npm install | ||
|
||
COPY ./back/ ./back/ | ||
COPY ./front/ ./front/ | ||
|
||
ENV NODE_ENV=production | ||
|
||
RUN npm run build | ||
|
||
# | ||
|
||
FROM base | ||
|
||
COPY --from=build /home/node/app/back/dist/ ./back/dist/ | ||
COPY --from=build /home/node/app/front/dist/ ./front/dist/ | ||
|
||
# | ||
|
||
USER node | ||
EXPOSE 3000/tcp | ||
ENTRYPOINT [ "npm", "start" ] |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.