Skip to content

Commit

Permalink
Merge branch 'ci/add-docker-builds' into hashicorp-feature-tmkms
Browse files Browse the repository at this point in the history
  • Loading branch information
helder-moreira committed Jan 31, 2024
2 parents 7deb16d + db77bd8 commit f2f35f4
Show file tree
Hide file tree
Showing 3 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/${{ github.repository }}:${{ steps.get_version.outputs.version-without-v }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ tmkms.toml
/secrets
/.vscode
**/*.bin
.DS_Store
13 changes: 13 additions & 0 deletions Dockerfile.release
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
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
COPY --from=builder /app/target/release/tmkms /usr/local/bin/
ENTRYPOINT ["/usr/local/bin/tmkms"]

0 comments on commit f2f35f4

Please sign in to comment.