Skip to content

Commit

Permalink
update gh action to build image and add helm chart for deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
m-mattia-m committed Jul 29, 2024
1 parent f4c1581 commit c86a930
Show file tree
Hide file tree
Showing 7 changed files with 97 additions and 4 deletions.
20 changes: 20 additions & 0 deletions .docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM node:21-alpine3.17 as builder

WORKDIR /app

COPY package.json ./
COPY package-lock.json ./

RUN npm install

#RUN npm install --save nuxt

RUN npm install nuxt

COPY . .

RUN npm run build

EXPOSE 3000

CMD node ./.output/server/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
name: Deploy to GitHub Pages
on:
workflow_dispatch:
push:
branches:
- main
# push:
# branches:
# - main
jobs:
build:
runs-on: ubuntu-latest
Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/build-image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Build Docker Image

on:
push:
branches:
- main
- develop
- 'develop/**'

env:
IMAGE_NAME: formtion-frontend

jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build image
run: docker build . --file ./.docker/Dockerfile --tag $IMAGE_NAME
25 changes: 25 additions & 0 deletions .github/workflows/build-publish-image-in-ghcr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Build and Push Docker Image

on:
release:
types:
- created

env:
IMAGE_NAME: mattiamueggler-ch
IMAGE_TAG: ${{ github.event.release.tag_name }} # eg. v0.0.1
GH_USERNAME: m-mattia-m

jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build image
run: docker build . --file ./.docker/Dockerfile --tag $IMAGE_NAME --label $IMAGE_TAG
- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin
- name: Add tag to image
run: docker tag $IMAGE_NAME ghcr.io/$GH_USERNAME/$IMAGE_NAME:$IMAGE_TAG
- name: Push image to container-registry
run: docker push ghcr.io/$GH_USERNAME/$IMAGE_NAME:$IMAGE_TAG
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,7 @@ logs
!.env.example

# Nuxt
.nuxt
.nuxt

# Deployment
helm/values.yaml
4 changes: 4 additions & 0 deletions helm/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
description: A Helm chart to deploy this nuxt site on kubernetes for Kubernetes.
name: mattiamueggler-ch
version: 1.0.0
22 changes: 22 additions & 0 deletions helm/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Deployment

## values.yaml

```yaml
deployment:
namespace: adsf
name: adfd
image:
repository: ghcr.io/mattiamueggler/test-api
tag: 1.0.0
replicaCount: 1
pullPolicy: always
resources:
requests:
cpu: 200m
memory: 300Mi
secret:
nuxtDriveUploadUrl: https://kdrive.infomaniak.com/app/collaborate/590672/7efd85c4-76d2-4109-9cfd-e896b3346e1e
nuxtDriveDownloadUrl: https://kdrive.infomaniak.com/app/share/590672/c90c9156-d7ce-4560-8950-32c22f28c652
nuxtDrivePassword: MySafePassword123!
```

0 comments on commit c86a930

Please sign in to comment.