diff --git a/.github/workflows/push-to-gitea-registry.yaml b/.github/workflows/push-to-gitea-registry.yaml new file mode 100644 index 0000000..19c53ed --- /dev/null +++ b/.github/workflows/push-to-gitea-registry.yaml @@ -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 }} diff --git a/Dockerfile b/Dockerfile index b5269c3..d35ffc4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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