Add Docker image builds for PRs and main branch#26
Merged
Conversation
This commit enhances the CI/CD pipeline with the following features:
1. When a pull request is created or updated, a Docker image is built
and pushed to the container registry. The image is tagged with
`pr-<prid>`, where `<prid>` is the pull request ID.
2. When a commit is pushed to the `main` branch, a Docker image is
built and pushed to the container registry. The image is tagged with
`main`.
These changes provide continuous integration builds for pull requests and the main branch, allowing for better testing and deployment workflows.
The reusable test workflow was failing because the `sqlx` command was not found. This was happening because the `~/.cargo/bin` directory, where `cargo install` places binaries, was not in the system's `PATH`. This commit fixes the issue by adding a step to the workflow that appends `$HOME/.cargo/bin` to the `$GITHUB_PATH` environment file. This ensures that `sqlx-cli` and other cargo-installed binaries are available in subsequent steps.
The previous logic for installing `sqlx-cli` only ran when the cargo cache was not hit. This caused pipeline failures when the cache was hit but did not contain the `sqlx` binary. This commit fixes the issue by removing the conditional execution of the `cargo install sqlx-cli` step. The step will now run on every execution of the workflow, ensuring that `sqlx-cli` is always available. Cargo will efficiently handle cases where the binary is already installed.
This commit updates the reusable test workflow to use the `rust:latest-slim` Docker image instead of `rust:1-slim`. This ensures that the CI pipeline always uses the latest stable slim version of the Rust toolchain, as requested.
13hannes11
approved these changes
Aug 25, 2025
13hannes11
marked this pull request as ready for review
August 25, 2025 21:15
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds functionality to the CI/CD pipeline to build and push Docker images for pull requests and pushes to the main branch.