github actions #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Rust Docker Build and Publish | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build-and-publish: | |
name: Build and Publish Docker Image | |
runs-on: ubuntu-latest | |
env: | |
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | |
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | |
DOCKER_REGISTRY: ${{ secrets.DOCKER_REGISTRY }} | |
IMAGE_NAME: ${{ secrets.DOCKER_IMAGE }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Rust and Docker | |
uses: actions/setup-rust@v1 | |
with: | |
rust-version: stable | |
- name: Install Docker | |
uses: docker/setup-docker@v1 | |
- name: Build ARM64 Docker image | |
run: | | |
docker buildx create --use | |
docker buildx build --platform linux/arm64 -t $DOCKER_REGISTRY/$IMAGE_NAME:latest . | |
env: | |
DOCKER_CLI_AARCH64: 1 | |
DOCKER_BUILDKIT: 1 | |
- name: Log in to Docker registry | |
run: docker login $DOCKER_REGISTRY -u $DOCKER_USERNAME -p $DOCKER_PASSWORD | |
- name: Push Docker image | |
run: | | |
docker buildx create --use | |
docker buildx build --platform linux/arm64 -t $DOCKER_REGISTRY/$IMAGE_NAME:latest --push . | |
env: | |
DOCKER_CLI_AARCH64: 1 | |
DOCKER_BUILDKIT: 1 |