From 14f3ccc1f6db7b99485b462ba84f30dcc7686947 Mon Sep 17 00:00:00 2001 From: KeisukeYamashita <19yamashita15@gmail.com> Date: Fri, 26 Jul 2024 22:02:14 +0200 Subject: [PATCH 1/2] chore: mount instead of copy Signed-off-by: KeisukeYamashita <19yamashita15@gmail.com> --- .gitignore | 23 ++++++++++++++++++++++- Dockerfile | 4 ++-- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index d8fa3e3..2b2a8c8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,23 @@ -/target +### Generated by gibo (https://github.com/simonwhitaker/gibo) +### https://raw.github.com/github/gitignore/4488915eec0b3a45b5c63ead28f286819c0917de/Rust.gitignore + +# Generated by Cargo +# will have compiled files and executables +debug/ +target/ + +# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries +# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html +Cargo.lock + +# These are backup files generated by rustfmt +**/*.rs.bk + +# MSVC Windows builds of rustc generate these, which store debugging information +*.pdb + +# Commitlint binary +commitlint + +# Commitlint config file .commitlintrc.* diff --git a/Dockerfile b/Dockerfile index 76965b0..d88bd76 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,8 +3,8 @@ WORKDIR /app RUN apk update \ && apk add --no-cache musl-dev -COPY . . -RUN cargo install --path . + +RUN --mount=type=bind,target=. cargo install --path . FROM alpine LABEL maintainer="KeisukeYamashita <19yamashita15@gmail.com>" From b470ba6c7d3eb20b9962e7314b2826911b98f5c4 Mon Sep 17 00:00:00 2001 From: KeisukeYamashita <19yamashita15@gmail.com> Date: Thu, 22 Aug 2024 20:42:17 +0200 Subject: [PATCH 2/2] feat: release vx and vxy version along with the release Signed-off-by: KeisukeYamashita <19yamashita15@gmail.com> --- .github/workflows/release.yaml | 25 ++++++++++++++----------- Dockerfile | 10 +++++++--- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 210ed3a..9df13ae 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -87,31 +87,34 @@ jobs: docker: runs-on: ubuntu-latest environment: docker - needs: - - info steps: - uses: docker/setup-qemu-action@v3 + - uses: docker/setup-buildx-action@v3 + - uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + + - uses: docker/metadata-action@v5 + id: meta + with: + images: 1915keke/commitlint-rs + tags: | + type=raw,value=latest + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + - uses: docker/build-push-action@v6 with: platforms: linux/amd64,linux/arm64 push: true - tags: 1915keke/commitlint-rs:${{ needs.info.outputs.tag }} + tags: ${{ steps.meta.outputs.tags }} cache-from: type=gha cache-to: type=gha,mode=max - info: - runs-on: ubuntu-latest - outputs: - tag: ${{ steps.info.outputs.tag }} - steps: - - id: info - run: echo tag=$(echo $GITHUB_REF | cut -d / -f 3 | sed -e 's/v//') >> $GITHUB_OUTPUT - publish: runs-on: ubuntu-latest needs: diff --git a/Dockerfile b/Dockerfile index d88bd76..865dd55 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,19 @@ FROM rust:1.77-alpine as builder WORKDIR /app -RUN apk update \ +RUN --mount=type=cache,target=/var/cache/apk,sharing=locked \ + apk update \ && apk add --no-cache musl-dev -RUN --mount=type=bind,target=. cargo install --path . +COPY . . + +RUN cargo install --path . FROM alpine LABEL maintainer="KeisukeYamashita <19yamashita15@gmail.com>" -RUN apk update \ +RUN --mount=type=cache,target=/var/cache/apk,sharing=locked \ + apk update \ && apk add --no-cache musl-dev COPY --from=builder /usr/local/cargo/bin/commitlint /usr/local/bin/commitlint