ci: Add Docker test step

This commit is contained in:
Elian Doran 2024-08-07 22:16:49 +03:00
parent a8814f0e9b
commit 5295d956a2
No known key found for this signature in database
2 changed files with 41 additions and 0 deletions

View File

@ -15,11 +15,51 @@ env:
GHCR_REGISTRY: ghcr.io
DOCKERHUB_REGISTRY: docker.io
IMAGE_NAME: ${{ github.repository }}
TEST_TAG: triliumnext/notes:test
jobs:
test_docker:
name: Check Docker build
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Set up node & dependencies
uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"
- run: npm ci
- name: Run the TypeScript build
run: npx tsc
- name: Create server-package.json
run: cat package.json | grep -v electron > server-package.json
- name: Build and export to Docker
uses: docker/build-push-action@v6
with:
context: .
load: true
tags: ${{ env.TEST_TAG }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Run the container
run: |
docker run --rm ${{ env.TEST_TAG }}
build_docker:
name: Build Docker images
runs-on: ubuntu-latest
needs:
- test_docker
permissions:
contents: read
packages: write

View File

@ -8,6 +8,7 @@ on:
paths-ignore:
- "docs/**"
- "bin/**"
- ".github/workflows/main-docker.yml"
tags:
- "v*"
workflow_dispatch: