Skip to content

Commit

Permalink
Docker build script change
Browse files Browse the repository at this point in the history
  • Loading branch information
ryichando committed Jan 10, 2025
1 parent 0d4d05e commit 1f7b388
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 26 deletions.
34 changes: 10 additions & 24 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,18 @@ name: Docker Build

on:
workflow_dispatch:
inputs:
target:
type: choice
description: Build Target
options:
- compiled
- base

env:
REGISTRY: ghcr.io
NAME: ppf-contact-solver
jobs:
compiled:
build-image:
runs-on: ubuntu-latest
permissions:
contents: read
Expand All @@ -25,25 +31,5 @@ jobs:
uses: docker/build-push-action@v5
with:
push: true
build-args: BUILD_MODE=compile
tags: ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.NAME }}:latest
base:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Docker Login
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build Image
uses: docker/build-push-action@v5
with:
push: true
build-args: BUILD_MODE=base
tags: ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.NAME }}-base:latest
build-args: BUILD_MODE=${{ github.event.inputs.target }}
tags: ${{ env.REGISTRY }}/${{ github.repository }}/${{ github.event.inputs.target }}:latest
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ RUN apt update
RUN apt install -y git python3 curl
RUN python3 warmup.py

RUN if [ "$BUILD_MODE" = "compile" ]; then \
RUN if [ "$BUILD_MODE" = "compiled" ]; then \
/root/.cargo/bin/cargo build --release; \
else \
cd /root && rm -rf /root/${PROJ_NAME}; \
Expand All @@ -26,7 +26,7 @@ RUN if [ "$BUILD_MODE" = "compile" ]; then \
WORKDIR /root
RUN rm -rf /var/lib/apt/lists/*

CMD if [ "$BUILT_MODE" = "compile" ]; then \
CMD if [ "$BUILT_MODE" = "compiled" ]; then \
cd /root/${PROJ_NAME} && python3 warmup.py jupyter; \
else \
bash; \
Expand Down

0 comments on commit 1f7b388

Please sign in to comment.