Skip to content

Commit

Permalink
Merge pull request #10 from moriyalab/fix/ci
Browse files Browse the repository at this point in the history
Support MultistageBuild
  • Loading branch information
TakanoTaiga authored Nov 1, 2024
2 parents 72fd133 + 9216d3d commit 607fefd
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build-and-push:
Expand All @@ -13,6 +16,7 @@ jobs:
uses: actions/checkout@v3

- name: Log in to GitHub Container Registry
if: github.event_name == 'workflow_dispatch'
uses: docker/login-action@v2
with:
registry: ghcr.io
Expand All @@ -21,8 +25,11 @@ jobs:

- name: Build Docker image
run: |
docker build -t ghcr.io/${{ github.repository }}:latest .
docker build -t ghcr.io/${{ github.repository }}_dev:latest --target builder_image .
docker build -t ghcr.io/${{ github.repository }}:latest --target release_image .
- name: Push Docker image
if: github.event_name == 'workflow_dispatch'
run: |
docker push ghcr.io/${{ github.repository }}_dev:latest
docker push ghcr.io/${{ github.repository }}:latest
17 changes: 0 additions & 17 deletions .github/workflows/docker_check.yml

This file was deleted.

16 changes: 9 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.10.15-slim-bullseye
FROM python:3.10.15-slim-bullseye AS builder_image

RUN apt-get update && apt-get install -y git curl ffmpeg
RUN git config --global --add safe.directory /app
Expand All @@ -7,11 +7,13 @@ RUN python3 -m pip install poetry \
&& poetry config virtualenvs.create false

WORKDIR /app
COPY pyproject.toml* poetry.lock* /app/
RUN poetry install
RUN rm -rf /app/pyproject.toml* /app/poetry.lock*

# For Huggingface
# COPY . /app/
COPY pyproject.toml poetry.lock ./
RUN poetry install --no-root

# CMD [ "python3", "lab_tool_webui.py" ]
FROM builder_image AS release_image

COPY --from=builder_image /app /app
COPY . /app/

CMD [ "python3", "lab_tool_webui.py" ]
2 changes: 1 addition & 1 deletion run_dev_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ PLATFORM="$(uname -m)"
if [ $PLATFORM = "x86_64" ]; then
echo "x86"
docker pull ghcr.io/moriyalab/lab_tool:latest
docker run -it --rm -v $ROOT:/app -w /app --network host ghcr.io/moriyalab/lab_tool:latest /bin/bash
docker run -it --rm -v $ROOT:/app -w /app --network host ghcr.io/moriyalab/lab_tool_dev:latest /bin/bash
else
echo "Not Support Platform. Only support x86."
fi

0 comments on commit 607fefd

Please sign in to comment.