chore(github): build a docker image for the website and charts #181
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
name: Website Deployment | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20.x' | |
registry-url: 'https://registry.npmjs.org' | |
cache: 'npm' | |
- name: Install dependencies | |
run: npm ci | |
- name: Build website | |
run: npx nx build website --skip-nx-cache --configuration production | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ vars.REGISTRY_URL }}/fabienvauchelles/scrapoxy-website | |
- name: Login to Scrapoxy Docker Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ vars.REGISTRY_URL }} | |
username: ${{ secrets.REGISTRY_USERNAME }} | |
password: ${{ secrets.REGISTRY_PASSWORD }} | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: packages/website/docker/Dockerfile | |
tags: ${{ vars.REGISTRY_URL }}/fabienvauchelles/scrapoxy-website:latest | |
push: true | |
- name: Setup Kubernetes | |
uses: azure/k8s-set-context@v4 | |
with: | |
method: service-account | |
k8s-url: ${{ vars.KUBE_URL }} | |
k8s-secret: "${{ secrets.KUBE_SECRET }}" | |
- name: Rollout restart | |
run: kubectl rollout restart deployment "${{ vars.KUBE_NAME }}-website" --namespace="${{ vars.KUBE_NAMESPACE }}" |