Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: build multi arch docker images using buildx
Browse files Browse the repository at this point in the history
- ignore docker login in pull requests

-fix release path
kskarthik committed Sep 4, 2024

Verified

This commit was signed with the committer’s verified signature.
1 parent fef98b8 commit dfde8b8
Showing 2 changed files with 17 additions and 10 deletions.
22 changes: 14 additions & 8 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -2,8 +2,9 @@ name: Docker CI

on:
push:
# runs on every commit
branches: ["master"]
branches:
- master
pull_request:

permissions:
contents: read
@@ -15,11 +16,16 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Build the docker image
run: docker build -t steelscheme/steel:latest .

- name: Authenticate to the Docker Hub
run: docker login -u steelscheme -p ${{ secrets.DOCKER_HUB_PWD }}
if: ${{ github.event_name != 'pull_request' }}
uses: docker/login-action@v3
with:
username: steelscheme
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Push the docker image
run: docker push steelscheme/steel:latest
- name: Build docker image
run: |
docker buildx build --push --platform linux/amd64,linux/arm64 -t steelscheme/steel:latest .
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM rust:slim as build
FROM rust:slim AS build

COPY . /steel/

@@ -16,13 +16,14 @@ RUN mkdir -p /lib/steel/
ENV STEEL_HOME="/lib/steel"

RUN cargo build --release

RUN cargo install --path crates/cargo-steel-lib

RUN cd cogs && cargo run -- install.scm

FROM rust:slim

COPY --from=build /steel/target/debug/steel /usr/local/bin
COPY --from=build /steel/target/release/steel /usr/local/bin

COPY --from=build /lib/steel /lib/

0 comments on commit dfde8b8

Please sign in to comment.