Add github actions
This commit is contained in:
37
.github/workflows/docker.yaml
vendored
Normal file
37
.github/workflows/docker.yaml
vendored
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
name: Docker Build
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- dev
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
docker_build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
id: buildx
|
||||||
|
uses: docker/setup-buildx-action@v1
|
||||||
|
- name: Login to Github Packages
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
- name: Set tag environment variable
|
||||||
|
id: set-tag
|
||||||
|
run: |
|
||||||
|
echo "TAG_SLUG=${GITHUB_REF_NAME}-${GITHUB_SHA:0:7}-$(date +%s)" >> "$GITHUB_OUTPUT"
|
||||||
|
- name: Build and push
|
||||||
|
id: docker_build
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: ./Dockerfile
|
||||||
|
push: true
|
||||||
|
tags: ghcr.io/chpwssn/us-api:${{steps.set-tag.outputs.TAG_SLUG}}
|
||||||
|
- name: Image digest
|
||||||
|
run: 'echo TAG: ghcr.io/chpwssn/us-api:${{steps.set-tag.outputs.TAG_SLUG}} SHA: ${{ steps.docker_build.outputs.digest }}'
|
||||||
|
|
Reference in New Issue
Block a user