Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

Create create_container.yaml #2

Create create_container.yaml

Create create_container.yaml #2

name: create container
on:
push:
branches:
- master
- main
pull_request:
branches:
- master
- main
paths-ignore:
- "**.md"
jobs:
build-api:
timeout-minutes: 10
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set envs
run: |
echo "GITHUB_REPO=$(echo ${GITHUB_REPOSITORY})" >> $GITHUB_ENV
echo "GITHUB_REF_NAME=$(echo ${GITHUB_REF_NAME | grep -v '/merge'})" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io/dhtech
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64
no-cache: true
file: ./Dockerfile
push: true
tags: |
ghcr.io/${{ env.GITHUB_REPO }}:${{ env.GITHUB_REF_NAME }}