Skip to content

Docker Image CI

Docker Image CI #42

Workflow file for this run

name: Docker Image CI
on:
workflow_dispatch:
pull_request:
branches: [ 'vlab' ]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ustc-vlab/filestash
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Extract metadata
uses: docker/metadata-action@v5
if: github.ref == 'refs/heads/vlab'
id: meta
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build the Docker image
if: github.ref == 'refs/heads/vlab'
run: docker build . --file docker/Dockerfile.multistage --tag ${{ steps.meta.outputs.tags }}
- name: Build the Docker image (Test PR only)
if: github.ref != 'refs/heads/vlab'
run: docker build . --file docker/Dockerfile.multistage
- name: Login to ghcr
uses: docker/login-action@v3
if: github.ref == 'refs/heads/vlab'
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
if: github.ref == 'refs/heads/vlab'
run: docker push ${{ steps.meta.outputs.tags }}