diff --git a/.github/workflows/update-docker-image.yml b/.github/workflows/update-docker-image.yml new file mode 100644 index 0000000..7d541e5 --- /dev/null +++ b/.github/workflows/update-docker-image.yml @@ -0,0 +1,38 @@ +name: Update Docker image +on: + workflow_dispatch: + +jobs: + push-image: + name: Push latest image + runs-on: ubuntu-latest + outputs: + cargo_cache_key: ${{ steps.cargo_cache_key.outputs.value }} + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Fetch all tags + run: git fetch --tags + + - name: Get latest tag + id: get-latest-tag + run: | + LATEST_TAG=$(git tag --list 'v[0-9]*.[0-9]*.[0-9]*' | sort -V | tail -n 1) + echo "LATEST_TAG=${LATEST_TAG}" >> $GITHUB_ENV + echo "Latest tag: ${LATEST_TAG}" + + - name: Verify LATEST_TAG + run: echo "LATEST_TAG is ${{ env.LATEST_TAG }}" + + - name: Build Docker image + run: docker build -t tinted-builder-rust . + + - name: Tag Docker image + run: docker tag tinted-builder-rust ghcr.io/tinted-theming/tinted-builder-rust:${{ env.LATEST_TAG }} + + - name: Log in to GitHub Container Registry + run: echo ${{ secrets.DOCKER_GHCR }} | docker login ghcr.io -u tinted-theming-bot --password-stdin + + - name: Push Docker image + run: docker push ghcr.io/tinted-themuing/tinted-builder-rust:${{ env.LATEST_TAG }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..c19b7f6 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,16 @@ +FROM rust:latest as builder +WORKDIR /usr/src/tinted-builder-rust + +# Copy required compilation source +COPY Cargo.toml Cargo.lock ./ +COPY tinted-builder ./tinted-builder +COPY tinted-builder-rust ./tinted-builder-rust + +# Build and test +RUN cargo build -p tinted-builder-rust --release +RUN cargo test -p tinted-builder-rust --release + +FROM rust:latest +COPY --from=builder /usr/src/tinted-builder-rust/target/release/tinted-builder-rust /usr/local/bin/tinted-builder-rust + +ENTRYPOINT ["tinted-builder-rust"]