mirror of
https://github.com/resourcespace/docker.git
synced 2025-10-07 10:04:27 +00:00
github actions to automate building the docker image
This commit is contained in:
38
.github/workflows/build-and-push.yml
vendored
Normal file
38
.github/workflows/build-and-push.yml
vendored
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
name: Publish Docker container
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main # or the default branch of your repository
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-push:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Check out the repo
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Get short SHA
|
||||||
|
id: short-sha
|
||||||
|
run: echo "::set-output name=sha::$(echo $GITHUB_SHA | cut -c1-6)"
|
||||||
|
|
||||||
|
- name: Log in to GitHub Container Registry
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.repository_owner }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Build and push Docker image
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: ./Dockerfile
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
ghcr.io/${{ github.repository }}/resourcespace:latest
|
||||||
|
ghcr.io/${{ github.repository }}/resourcespace:${{ steps.short-sha.outputs.sha }}
|
Reference in New Issue
Block a user