add container step
Build and push Docker image / build-and-publish (push) Successful in 2m42s Details

This commit is contained in:
Hamcha 2024-04-17 01:28:06 +02:00
parent 9e19eae323
commit 7625df58ca
Signed by: hamcha
GPG Key ID: 1669C533B8CF6D89
3 changed files with 44 additions and 0 deletions

3
.dockerignore Normal file
View File

@ -0,0 +1,3 @@
/target
.forgejo
README.md

View File

@ -0,0 +1,32 @@
name: Build and push Docker image
on:
push:
jobs:
build-and-publish:
runs-on: docker
steps:
- uses: actions/checkout@v4
- name: Build latest
uses: https://codeberg.org/umglurf/kaniko-action@main
with:
cache: true
cache_repo: ${{ vars.REGISTRY_URL }}/${{ github.repository }}/cache
credentials: |
${{ vars.REGISTRY_URL }}=${{ secrets.REGISTRY_USERNAME }}:${{ secrets.REGISTRY_TOKEN }}
destinations: |
${{ vars.REGISTRY_URL }}/${{ github.repository }}:latest
push: 'true'
if: github.ref == 'refs/heads/master'
- name: Build ref
uses: https://codeberg.org/umglurf/kaniko-action@main
with:
cache: true
cache_repo: ${{ vars.REGISTRY_URL }}/${{ github.repository }}/cache
credentials: |
${{ vars.REGISTRY_URL }}=${{ secrets.REGISTRY_USERNAME }}:${{ secrets.REGISTRY_TOKEN }}
destinations: |
${{ vars.REGISTRY_URL }}/${{ github.repository }}:${{ github.ref_name }}
push: 'true'
if: github.ref != 'refs/heads/master'

9
Dockerfile Normal file
View File

@ -0,0 +1,9 @@
FROM rustlang/rust:nightly-alpine AS build
WORKDIR /usr/src/serverman
COPY . .
RUN apk add --no-cache musl-dev && \
cargo install --path .
FROM rustlang/rust:nightly-alpine
COPY --from=build /usr/local/cargo/bin/serverman /usr/local/bin/serverman
ENTRYPOINT [ "serverman" ]