Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

82 feature request suggestion create GitHub actions workflow for automating the build and deployments for feature branches #87

Draft
wants to merge 67 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
bf94dd0
Add GitHub Actions workflow for building and deploying containers
lmcdonough Dec 13, 2024
a3398db
fixed error with pr to main.
lmcdonough Dec 13, 2024
69aa975
updates env vars to be injected into images on build
lmcdonough Dec 13, 2024
c382d48
updates database url
lmcdonough Dec 13, 2024
54f787f
Enhance GitHub Actions workflow for building and deploying containers…
lmcdonough Dec 15, 2024
5623cde
correcting attestations
lmcdonough Dec 15, 2024
d480f1f
Fix subject-name formatting in artifact attestation for backend and f…
lmcdonough Dec 15, 2024
065c692
fixes docker compose and build_and_run script.
lmcdonough Feb 8, 2025
5ac72eb
update docker-compose to use environment variables for backend command
lmcdonough Feb 8, 2025
c882dd2
Update README and Container-README with additional information and Gi…
lmcdonough Feb 10, 2025
3c69e9d
added comment to dockerfile
lmcdonough Feb 14, 2025
8df8b2b
Add GitHub Actions workflow for building and deploying containers
lmcdonough Dec 13, 2024
937c6a4
Update Dockerfile and docker-compose for improved configuration and s…
lmcdonough Feb 14, 2025
968e931
Update dependencies to latest versions including axum, sqlx, and utoipa
lmcdonough Feb 16, 2025
89fdc65
removes sqlite dependencies from Cargo files.
lmcdonough Feb 21, 2025
8771925
removes sqlite deps, upgrades tower for service
lmcdonough Feb 21, 2025
db53d22
merges remaining changes from main.
lmcdonough Mar 6, 2025
0398035
removing cargo clean, bc it can negate Docker layer Caching
lmcdonough Mar 6, 2025
285ea88
removes sqlite dependencies, update tower version to 0.5.1
lmcdonough Mar 6, 2025
06aad1a
merges in changes from test branch.
lmcdonough Mar 14, 2025
9bbd555
removes sqlite dependency from Cargo.toml files.
lmcdonough Mar 14, 2025
6d905e7
adds correspondong lock file.
lmcdonough Mar 14, 2025
cc882ec
updates build and deploy container gh actions workflow
lmcdonough Mar 14, 2025
61816e3
noop: addresses README linting warning.
lmcdonough Mar 14, 2025
fff43a2
adds ARM64 cross-compilation tools to Docker builder image
lmcdonough Mar 14, 2025
9612908
adds the ARM64 architecture support before installing ARM64-specific …
lmcdonough Mar 14, 2025
f786bcd
adds openssl dependencies for cross compilation to Dockerfile and gh …
lmcdonough Mar 14, 2025
3aa5c5e
adds openssl and pkg config env vars to ci gh actions workflow
lmcdonough Mar 14, 2025
a492e0c
adds openssl env vars and aarch linux build deps in Dockerfile
lmcdonough Mar 14, 2025
3a68ddf
adds cross additional build platform target to ci gh actions file and…
lmcdonough Mar 14, 2025
9251304
adds support for aarch64 architecture in CI workflow by updating Rust…
lmcdonough Mar 14, 2025
0f9f8f8
brings ci.yml gh actions workflow to parity with main.
lmcdonough Mar 14, 2025
2570c3f
adds binutils for aarch64 to Dockerfile.
lmcdonough Mar 14, 2025
927ddb8
adds ARM64 cross-compilation support in Dockerfile by installing nece…
lmcdonough Mar 14, 2025
86c8b33
adds libssl-dev instalation to ci.yml gh actions workflow.
lmcdonough Mar 14, 2025
510d2b7
removes dpkg arm installs, moves symlink setup, ensures .cargo.confin…
lmcdonough Mar 15, 2025
eecd256
adds QEMU setup, forces cargo to rebuild correct linker in gh actions…
lmcdonough Mar 15, 2025
c3b2583
adds support for aarch64 target in CI workflow and sets OpenSSL paths
lmcdonough Mar 15, 2025
7d10d41
adds matching cargo lock file
lmcdonough Mar 15, 2025
fe8f8fa
adds support for ARM64 cross-compilation in Dockerfile
lmcdonough Mar 15, 2025
43f1541
adds support for ARM64 architecture in Dockerfile and conditionally i…
lmcdonough Mar 15, 2025
062afc5
adds ARM64-specific packages to Dockerfile for cross-compilation support
lmcdonough Mar 15, 2025
62aef9f
removes ARM64-specific packages from Dockerfile to streamline install…
lmcdonough Mar 15, 2025
5fcfe9c
refactors Dockerfile to create to builder images for compiling and ad…
lmcdonough Mar 18, 2025
3a4d923
adds entrypoint.sh which dynamically determines the host architecture…
lmcdonough Mar 18, 2025
f1daa69
reconciles Cargo.lock file
lmcdonough Mar 18, 2025
4bfcb98
update conditional compilation and renames binary locationds from arc…
lmcdonough Mar 18, 2025
c9119ec
updates entrypoint.sh to match new binary locations from docker image
lmcdonough Mar 18, 2025
bec909e
adds dpkg multi arch repo to dockerfile in second builder
lmcdonough Mar 18, 2025
af8c6e3
removes dpkg installation and arm package specification from builder …
lmcdonough Mar 18, 2025
c4b950b
adds modified Cargo.lock file
lmcdonough Mar 18, 2025
7f996b7
adds ENV vars to dynamically locate the compiler dependent on archite…
lmcdonough Mar 18, 2025
bb9f17d
adds openssl-sys crate
lmcdonough Mar 19, 2025
c36acc4
adds vendored feature for openssl-sys, adds cross.
lmcdonough Mar 19, 2025
60fc0dd
refactor GitHub Actions ci workflow to simplify cache key for depende…
lmcdonough Mar 21, 2025
cf57543
adds badge for image build and storage workflow in README
lmcdonough Mar 21, 2025
242ac4a
refactor Dockerfile and related configurations for improved multi-pla…
lmcdonough Mar 28, 2025
eba29d0
correcting README
lmcdonough Mar 28, 2025
ea3d6a1
addresses cache key conflict
lmcdonough Mar 28, 2025
5e66ef5
fixes cache key collision in container builds
lmcdonough Mar 28, 2025
e9cf909
update rust-app image reference to use specific GitHub container
lmcdonough Mar 28, 2025
ba46bde
add healthcheck for postgres service and ensure rust-app waits for se…
lmcdonough Mar 28, 2025
c5f1bde
update Dockerfile to install bash and change entrypoint script to use…
lmcdonough Mar 28, 2025
a1cfa2b
install bash in Dockerfile for improved script compatibility
lmcdonough Mar 28, 2025
a3aede9
corrects dockerfile to always use buildx and corrects binary not foun…
lmcdonough Mar 28, 2025
e1393bd
fixes container workflow to use buildx for multi-platform support
lmcdonough Mar 28, 2025
2415efa
corrects entrypoint.sh to correctly execute the correct binary and pa…
lmcdonough Mar 28, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
126 changes: 126 additions & 0 deletions .github/workflows/build_and_deploy_containers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
name: Build and Deploy Containers

on:
push:
branches:
- main
pull_request:
branches:
- main
types: [opened, synchronize, reopened]
workflow_dispatch:

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build_test_run:
runs-on: ubuntu-22.04

steps:
# Checkout code
- uses: actions/checkout@v4

# Enable QEMU for multi-arch builds (arm64 on x86)
- name: Set up Rust + QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: linux/amd64,linux/arm64

# Install Rust and cache artifacts
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable

- uses: Swatinem/rust-cache@v2
with:
shared-key: ${{ runner.os }}-cargo-${{ github.sha }}

# Install sea-orm-cli globally (if needed for migration or seed)
- name: Install sea-orm-cli
run: cargo install sea-orm-cli

# Run tests for x86_64 only (CI feedback)
- name: Run tests
run: cargo test --release

build_and_push_docker:
runs-on: ubuntu-22.04
needs: build_test_run
permissions:
contents: read
packages: write
attestations: write
id-token: write

steps:
# Checkout source code
- uses: actions/checkout@v4

# Docker login to GHCR
- name: Docker login
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# Set up Docker Buildx for multi-platform builds
- uses: docker/setup-buildx-action@v3
with:
install: true

# Show current Docker cache usage
- name: Show Docker Build Cache (Before)
run: |
echo -e "\033[1;34m🔍 Checking buildx cache BEFORE build...\033[0m"
docker buildx du || echo -e "\033[1;33m⚠️ No cache found yet.\033[0m"

# Compute image tag
- name: Determine Image Tags
id: tags
run: |
BRANCH_NAME=${GITHUB_HEAD_REF:-${GITHUB_REF##*/}}
IMAGE_NAME="${{ env.REGISTRY }}/${{ github.repository }}/${BRANCH_NAME}"
echo "backend_tags=$IMAGE_NAME:latest" >> $GITHUB_OUTPUT
echo "backend_image_name=$IMAGE_NAME" >> $GITHUB_OUTPUT

# Build and push multi-arch Docker image with cache
- name: Build + Push Backend
id: push_backend
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64 # ✅ Key multi-arch setting
push: true
provenance: true
tags: ${{ steps.tags.outputs.backend_tags }}
cache-from: type=gha
cache-to: type=gha,mode=max

# Show updated cache usage
- name: Show Docker Build Cache (After)
run: |
echo -e "\033[1;34m📦 Checking buildx cache AFTER build...\033[0m"
docker buildx du || echo -e "\033[1;31m❌ Failed to get updated cache info\033[0m"

# Attest build provenance if on main branch
- name: Attest Backend
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
uses: actions/attest-build-provenance@v2
with:
subject-name: ${{ steps.tags.outputs.backend_image_name }}
subject-digest: ${{ steps.push_backend.outputs.digest }}
push-to-registry: true

# Output how to pull and run the pushed image
- name: Print Usage Instructions
run: |
echo -e "\033[1;32m✅ Backend Image Pushed:\033[0m"
echo " docker pull ${{ steps.tags.outputs.backend_image_name }}:latest"
echo ""
echo -e "\033[1;36m▶️ Run Backend:\033[0m"
echo " docker run --rm --env-file .env -p 8000:8000 ${{ steps.tags.outputs.backend_image_name }}:latest"
12 changes: 11 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,17 @@ jobs:
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-unknown-linux-gnu
targets: x86_64-unknown-linux-gnu,aarch64-unknown-linux-gnu

- name: Use cached dependencies
uses: Swatinem/rust-cache@v2
with:
key: "ubuntu-22.04-x86_64-and-aarch64"

- name: Set OpenSSL Paths
run: |
echo "OPENSSL_LIB_DIR=/usr/lib/x86_64-linux-gnu" >> $GITHUB_ENV
echo "OPENSSL_INCLUDE_DIR=/usr/include/x86_64-linux-gnu" >> $GITHUB_ENV

- name: Use cached dependencies
uses: Swatinem/rust-cache@v2
Expand Down
Loading
Loading