Skip to content

Build and push docker image #4

Build and push docker image

Build and push docker image #4

Workflow file for this run

name: Create and publish a Docker image
on:
push:
branches:
- main
pull_request:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Setup rust
uses: actions-rs/[email protected]
with:
profile: minimal
toolchain: stable
- name: Checkout repository
uses: actions/checkout@v4
- name: Build release
run: cargo build --release --bin server
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
with:
install: true
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build image
run: >-
docker buildx build --push
--file ./Dockerfile
--tag ghcr.io/$IMAGE_NAME:latest
--tag ghcr.io/$IMAGE_NAME:$VERSION
.