Skip to content

Commit

Permalink
chore(action): split up github docker actions to build faster
Browse files Browse the repository at this point in the history
  • Loading branch information
Datron committed Sep 3, 2024
1 parent c6201fa commit be2abe3
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 13 deletions.
12 changes: 1 addition & 11 deletions .github/workflows/docker_image_gen.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Create docker images
name: Create superposition docker image

on: workflow_dispatch

Expand Down Expand Up @@ -40,15 +40,5 @@ jobs:
with:
push: true
context: .
file: ./DockerFile
platforms: linux/amd64,linux/arm64
tags: datron1/superposition:${{ steps.git_tag.outputs.docker_tag }}, datron1/superposition:latest

- name: Build and push example image
uses: docker/build-push-action@v6
with:
push: true
context: .
platforms: linux/amd64,linux/arm64
file: ./example.DockerFile
tags: datron1/superposition-demo-app:${{ steps.git_tag.outputs.docker_tag }}, datron1/superposition-demo-app:latest
45 changes: 45 additions & 0 deletions .github/workflows/example_docker_image_gen.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Create superposition example docker image

on: workflow_dispatch

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.SUPERPOSITION_TOKEN }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Get latest tag
id: git_tag
shell: bash
run: |
docker_tag=`git tag -l --sort=-creatordate | grep "^v" | head -n 1 | sed 's/^v//'`
echo "docker_tag=$docker_tag" >> $GITHUB_OUTPUT
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push example image
uses: docker/build-push-action@v6
with:
push: true
context: .
platforms: linux/amd64,linux/arm64
file: ./example.Dockerfile
tags: datron1/superposition-demo-app:${{ steps.git_tag.outputs.docker_tag }}, datron1/superposition-demo-app:latest
2 changes: 1 addition & 1 deletion DockerFile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ RUN cargo build --release
RUN pwd
RUN ls -l target

FROM ubuntu:24.04 as runtime
FROM debian:bookworm-slim as runtime

ENV NODE_VERSION=18.19.0
WORKDIR /app
Expand Down
2 changes: 1 addition & 1 deletion example.DockerFile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ RUN cp .env.example target/.env
# building backend
RUN cargo build --release

FROM ubuntu:24.04 as runtime
FROM debian:bookworm-slim as runtime

ENV NODE_VERSION=18.19.0
WORKDIR /app
Expand Down

0 comments on commit be2abe3

Please sign in to comment.