Skip to content

Commit

Permalink
ci: add build docker
Browse files Browse the repository at this point in the history
  • Loading branch information
MistEO committed Jan 7, 2025
1 parent e37b1ad commit 78c78a6
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Build docker

on:
workflow_dispatch:
push:
branches:
- "**"
paths:
- ".github/workflows/build.yml"
- "src/**"
- "**.py"
pull_request:
branches:
- "**"
paths:
- ".github/workflows/build.yml"
- "src/**"
- "**.py"

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Install deps
run: python -m pip install -r requirements.txt

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io${{ env.REGISTRY }}/${{ github.repository }}

- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: true
tags: "ghcr.io/mirrorchyan/billing-backend:latest"
labels: ${{ steps.meta.outputs.labels }}

0 comments on commit 78c78a6

Please sign in to comment.