Update Dockerfile and CI workflow #267
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: CI | |
on: [push] | |
jobs: | |
test: | |
name: Run tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- run: npm install | |
- run: npm run lint | |
- run: npm run test | |
build: | |
# TODO: Remove the following line to enable the build job | |
if: false | |
name: Build Docker image | |
# Uncomment the following line to run the job only when the push event is triggered on the main branch | |
# if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
needs: [test] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Generate Docker tags | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ghcr.io/inputstudio/nuxt3-starter # TODO: Modify this to your own image name | |
tags: | | |
type=raw,value=latest | |
type=sha | |
- name: Setup Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Container Registry # TODO: Can be replaced with any other registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build image | |
uses: docker/build-push-action@v5 | |
with: | |
push: false # TODO: Set it to true to push (currently set to false for testing purposes) | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |