Skip to content

Commit

Permalink
ci(build): add docker builds workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
helder-moreira committed Nov 26, 2024
1 parent dba492a commit a7e7396
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Build Docker Image

on:
push:
tags:
- "*"

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Get version
id: get_version
uses: battila7/get-version-action@v2

- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
file: Dockerfile.release
push: true
platforms: linux/amd64,linux/arm64
tags: ghcr.io/nibiruchain/tmkms:${{ steps.get_version.outputs.version-without-v }}
14 changes: 14 additions & 0 deletions Dockerfile.release
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM rust:1.75-alpine AS builder

RUN apk add --no-cache g++ zlib zlib-dev git linux-headers libressl-dev libmagic libusb-dev hidapi-dev eudev-dev

WORKDIR /app
COPY . /app

ENV CARGO_NET_GIT_FETCH_WITH_CLI=true
RUN cargo build --release --features "$(grep 'feature =' src/keyring/providers.rs | tr -d '[:blank:]' | sort | uniq | cut -d '"' -f 2 | xargs)"

FROM alpine
RUN apk add --no-cache tini
COPY --from=builder /app/target/release/tmkms /usr/local/bin/
ENTRYPOINT ["/sbin/tini", "--", "/usr/local/bin/tmkms"]

0 comments on commit a7e7396

Please sign in to comment.