Skip to content

Commit

Permalink
Update docker image builds
Browse files Browse the repository at this point in the history
  • Loading branch information
johnshaughnessy committed Nov 1, 2023
1 parent 9dbe228 commit 246b9b5
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 8 deletions.
33 changes: 29 additions & 4 deletions .github/workflows/build-server-image.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: Build server image
name: Build server images

on:
push:
branches:
- main

jobs:
build_base_builder:
build_docker_image_track_base_builder:
runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -42,9 +42,9 @@ jobs:
docker build -f Dockerfile.base-builder --target base-builder -t us-central1-docker.pkg.dev/hubs-dev-333333/ocho-osai/johnshaughnessy/track/track-base-builder .
docker push us-central1-docker.pkg.dev/hubs-dev-333333/ocho-osai/johnshaughnessy/track/track-base-builder
build_and_push:
build_docker_image_track_server:
runs-on: ubuntu-latest
needs: build_base_builder
needs: build_docker_image_track_base_builder

steps:
- name: Checkout code
Expand All @@ -66,3 +66,28 @@ jobs:
cd server
docker build -t us-central1-docker.pkg.dev/hubs-dev-333333/ocho-osai/johnshaughnessy/track/track-server .
docker push us-central1-docker.pkg.dev/hubs-dev-333333/ocho-osai/johnshaughnessy/track/track-server
build_docker_image_track_migration_runner:
runs-on: ubuntu-latest
needs: build_docker_image_track_base_builder

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

- id: "auth"
uses: "google-github-actions/auth@v1"
with:
credentials_json: "${{ secrets.GCP_SA_KEY }}"

- name: "Set up Cloud SDK"
uses: "google-github-actions/setup-gcloud@v1"

- name: Configure Docker to use Google Artifact Registry
run: gcloud auth configure-docker us-central1-docker.pkg.dev

- name: Build and Push Migration Runner Image
run: |
cd server # Change this to your Dockerfile's directory if needed
docker build -t us-central1-docker.pkg.dev/hubs-dev-333333/ocho-osai/johnshaughnessy/track/track-migration-runner -f Dockerfile.migration .
docker push us-central1-docker.pkg.dev/hubs-dev-333333/ocho-osai/johnshaughnessy/track/track-migration-runner
4 changes: 0 additions & 4 deletions server/Dockerfile.base-builder
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,5 @@
FROM rust:1.73-slim-buster as base-builder
WORKDIR /usr/src/app
RUN apt-get update && apt-get install -y build-essential libpq-dev
cargo install diesel_cli --no-default-features --features postgres
COPY . .
# RUN cargo fetch # This fetches all dependencies as per Cargo.lock
RUN cargo build --release # This forces compilation of dependencies

# Upload this to johnshaughnessy/track/track-base-builder
8 changes: 8 additions & 0 deletions server/Dockerfile.migration-runner
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Base stage
FROM rust:1.73-slim-buster as base
WORKDIR /usr/src/app
RUN apt-get update && apt-get install -y build-essential libpq-dev
RUN cargo install diesel_cli --no-default-features --features postgres

# Copy migration files
COPY ./migrations /usr/src/app/migrations

0 comments on commit 246b9b5

Please sign in to comment.