Skip to content

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

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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
9b531be
Add GitHub Actions workflow for building and deploying containers
lmcdonough Dec 13, 2024
6ae121a
fixed error with pr to main.
lmcdonough Dec 13, 2024
d6d2b6d
updates env vars to be injected into images on build
lmcdonough Dec 13, 2024
83913c3
updates database url
lmcdonough Dec 13, 2024
13b648d
Enhance GitHub Actions workflow for building and deploying containers…
lmcdonough Dec 15, 2024
68b63c7
correcting attestations
lmcdonough Dec 15, 2024
05da9f8
Fix subject-name formatting in artifact attestation for backend and f…
lmcdonough Dec 15, 2024
696dd2b
fixes docker compose and build_and_run script.
lmcdonough Feb 8, 2025
e92b8ee
update docker-compose to use environment variables for backend command
lmcdonough Feb 8, 2025
e7b0d5d
Update README and Container-README with additional information and Gi…
lmcdonough Feb 10, 2025
fbdf807
added comment to dockerfile
lmcdonough Feb 14, 2025
df48601
Add GitHub Actions workflow for building and deploying containers
lmcdonough Dec 13, 2024
737e1d4
Update Dockerfile and docker-compose for improved configuration and s…
lmcdonough Feb 14, 2025
5c1dfe5
Update dependencies to latest versions including axum, sqlx, and utoipa
lmcdonough Feb 16, 2025
1fec2c1
removes sqlite dependencies from Cargo files.
lmcdonough Feb 21, 2025
9129073
removes sqlite deps, upgrades tower for service
lmcdonough Feb 21, 2025
1abc892
merges remaining changes from main.
lmcdonough Mar 6, 2025
9810165
removing cargo clean, bc it can negate Docker layer Caching
lmcdonough Mar 6, 2025
3215b1f
removes sqlite dependencies, update tower version to 0.5.1
lmcdonough Mar 6, 2025
ee9ead9
merges in changes from test branch.
lmcdonough Mar 14, 2025
6cf3575
removes sqlite dependency from Cargo.toml files.
lmcdonough Mar 14, 2025
757a2c9
adds correspondong lock file.
lmcdonough Mar 14, 2025
5925688
updates build and deploy container gh actions workflow
lmcdonough Mar 14, 2025
6d772b1
noop: addresses README linting warning.
lmcdonough Mar 14, 2025
31554ae
adds ARM64 cross-compilation tools to Docker builder image
lmcdonough Mar 14, 2025
785143a
adds the ARM64 architecture support before installing ARM64-specific …
lmcdonough Mar 14, 2025
2890876
adds openssl dependencies for cross compilation to Dockerfile and gh …
lmcdonough Mar 14, 2025
ed43e17
adds openssl and pkg config env vars to ci gh actions workflow
lmcdonough Mar 14, 2025
81b5e68
adds openssl env vars and aarch linux build deps in Dockerfile
lmcdonough Mar 14, 2025
e5956bb
adds cross additional build platform target to ci gh actions file and…
lmcdonough Mar 14, 2025
1858f85
adds support for aarch64 architecture in CI workflow by updating Rust…
lmcdonough Mar 14, 2025
80bbd28
brings ci.yml gh actions workflow to parity with main.
lmcdonough Mar 14, 2025
69358df
adds binutils for aarch64 to Dockerfile.
lmcdonough Mar 14, 2025
711f23a
adds ARM64 cross-compilation support in Dockerfile by installing nece…
lmcdonough Mar 14, 2025
a316cfd
adds libssl-dev instalation to ci.yml gh actions workflow.
lmcdonough Mar 14, 2025
42d95b9
removes dpkg arm installs, moves symlink setup, ensures .cargo.confin…
lmcdonough Mar 15, 2025
f72262b
adds QEMU setup, forces cargo to rebuild correct linker in gh actions…
lmcdonough Mar 15, 2025
c1a90b5
adds support for aarch64 target in CI workflow and sets OpenSSL paths
lmcdonough Mar 15, 2025
d1fc07e
adds matching cargo lock file
lmcdonough Mar 15, 2025
6c1be50
adds support for ARM64 cross-compilation in Dockerfile
lmcdonough Mar 15, 2025
bac3b47
adds support for ARM64 architecture in Dockerfile and conditionally i…
lmcdonough Mar 15, 2025
cccc8e1
adds ARM64-specific packages to Dockerfile for cross-compilation support
lmcdonough Mar 15, 2025
8614f74
removes ARM64-specific packages from Dockerfile to streamline install…
lmcdonough Mar 15, 2025
ea6212d
refactors Dockerfile to create to builder images for compiling and ad…
lmcdonough Mar 18, 2025
64cf860
adds entrypoint.sh which dynamically determines the host architecture…
lmcdonough Mar 18, 2025
2f71ff5
reconciles Cargo.lock file
lmcdonough Mar 18, 2025
8f574c8
update conditional compilation and renames binary locationds from arc…
lmcdonough Mar 18, 2025
b90bb3b
updates entrypoint.sh to match new binary locations from docker image
lmcdonough Mar 18, 2025
10cc989
adds dpkg multi arch repo to dockerfile in second builder
lmcdonough Mar 18, 2025
7637b80
removes dpkg installation and arm package specification from builder …
lmcdonough Mar 18, 2025
08da198
adds modified Cargo.lock file
lmcdonough Mar 18, 2025
85c245a
adds ENV vars to dynamically locate the compiler dependent on archite…
lmcdonough Mar 18, 2025
cf21522
adds openssl-sys crate
lmcdonough Mar 19, 2025
cbc8e16
adds vendored feature for openssl-sys, adds cross.
lmcdonough Mar 19, 2025
3e9c3ce
refactor GitHub Actions ci workflow to simplify cache key for depende…
lmcdonough Mar 21, 2025
b651c48
adds badge for image build and storage workflow in README
lmcdonough Mar 21, 2025
5ef2ba6
refactor Dockerfile and related configurations for improved multi-pla…
lmcdonough Mar 28, 2025
d8e281c
correcting README
lmcdonough Mar 28, 2025
7ca6329
addresses cache key conflict
lmcdonough Mar 28, 2025
f8cba7c
fixes cache key collision in container builds
lmcdonough Mar 28, 2025
f5ad045
update rust-app image reference to use specific GitHub container
lmcdonough Mar 28, 2025
f5e8480
add healthcheck for postgres service and ensure rust-app waits for se…
lmcdonough Mar 28, 2025
33106ab
update Dockerfile to install bash and change entrypoint script to use…
lmcdonough Mar 28, 2025
bc77c69
install bash in Dockerfile for improved script compatibility
lmcdonough Mar 28, 2025
04ddd45
corrects dockerfile to always use buildx and corrects binary not foun…
lmcdonough Mar 28, 2025
894272e
fixes container workflow to use buildx for multi-platform support
lmcdonough Mar 28, 2025
503a4c6
corrects entrypoint.sh to correctly execute the correct binary and pa…
lmcdonough Mar 28, 2025
76a5f8e
corrects docker compose file to use correct entrypoint, and image loc…
lmcdonough Apr 4, 2025
0d47844
updates Dockerfile to support multi-platform builds and changes expos…
lmcdonough Apr 4, 2025
c5f98a7
corrects rust-app image reference to ghcr and updates nextjs-app to u…
lmcdonough Apr 11, 2025
91bc521
updated container readme
lmcdonough Apr 11, 2025
6d3196d
fix: update container name for rust-app in docker-compose
lmcdonough Apr 12, 2025
db3620e
Update README.md
lmcdonough Apr 12, 2025
5372ece
Update Container-README.md
lmcdonough Apr 20, 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