Skip to content

Commit

Permalink
Merge pull request #133 from Concordium/lma/dockerimage
Browse files Browse the repository at this point in the history
Lma/dockerimage
  • Loading branch information
lassemand authored Feb 15, 2024
2 parents 94fd0ae + 6e83fc9 commit d9c8f3d
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 16 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Release workflow

on:
workflow_dispatch:

env:
RUST_VERSION: rust:1.70-buster

jobs:

build-and-push:
runs-on: ubuntu-latest
environment: release-recover-id-object
steps:
- name: Check out the repo
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Extract Cargo package version
id: cargo_version
run: |
cd recover-id-object
VERSION=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].version')
echo "Extracted version is $VERSION"
echo "::set-output name=version::$VERSION"
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: recover-id-object/scripts/Dockerfile
push: true
build-args: |
build_image=${{ env.RUST_VERSION }}
tags: concordium/recover-id-object:${{ steps.cargo_version.outputs.version }}
7 changes: 7 additions & 0 deletions recover-id-object/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Assumes docker context is repository root, i.e. ../ relative to this file.
*
!deps/concordium-rust-sdk
deps/concordium-rust-sdk/target
!recover-id-object/*
recover-id-object/target
recover-id-object/scripts
49 changes: 33 additions & 16 deletions recover-id-object/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions recover-id-object/scripts/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
ARG build_image=rust:1.70-buster
ARG base_image=debian:buster-slim
FROM ${build_image} AS build

WORKDIR /usr/app/recover-id-object

COPY recover-id-object .
COPY deps /usr/app/deps
RUN cargo build --release --locked

FROM ${base_image}

WORKDIR /usr/app

COPY --from=build /usr/app/recover-id-object/target/release/recover-id-object ./recover-id-object

RUN apt-get update && \
apt-get -y install \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*

RUN chmod +x recover-id-object

ENTRYPOINT ["./recover-id-object"]

0 comments on commit d9c8f3d

Please sign in to comment.