add image push workflow

This commit is contained in:
sim1222 2025-01-16 03:27:23 +09:00
parent fb5e0c7aef
commit f35413a6b9
Signed by: sim1222
GPG Key ID: D1AE30E316E44E5D
2 changed files with 44 additions and 1 deletions

View File

@ -0,0 +1,41 @@
name: Push Docker Image to gitea Container Repository
on:
push:
branches:
- *
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Gitea Container Registry
uses: docker/login-action@v3
with:
registry: ${{ secrets.REGISTRY }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
- name: Set up metadata
id: metadata
uses: docker/metadata-action@v5
with:
images: ${{ secrets.REGISTRY }}/${{ github.repository }}
tags: |
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/master' }}
type=sha
type=branch
- name: Build and push
uses: docker/build-push-action@v5
with:
file: ./Dockerfile
push: true
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}

View File

@ -1,6 +1,8 @@
FROM rust:1.84 as builder
WORKDIR /usr/src/app
COPY . .
COPY Cargo.toml .
COPY Cargo.lock .
COPY src src
RUN cargo install --path .
FROM debian:bookworm-slim