Skip to content

Commit

Permalink
+ add Dockerfile and gitflow
Browse files Browse the repository at this point in the history
  • Loading branch information
kebe7jun committed Sep 25, 2023
1 parent 2935533 commit c90c338
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/build-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Release

on:
push:
branches:
- 'main'

jobs:
docker-build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
# - name: Login to DockerHub
# uses: docker/login-action@v2
# with:
# username: ${{ secrets.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login Github Container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/kebe7jun/stable-diffusion-webui
tags: |
latest
- name: Build
uses: docker/build-push-action@v4
with:
context: Dockerfile
platforms: linux/amd64
push: true
provenance: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
42 changes: 42 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
FROM python:3.10

ARG SD_WEBUI_VERSION=v1.6.0
ENV SD_WEBUI_VERSION=${SD_WEBUI_VERSION}

RUN git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui -b ${SD_WEBUI_VERSION} --depth 1

WORKDIR /stable-diffusion-webui

RUN apt update && \
apt-get install ffmpeg libsm6 libxext6 -y --no-install-recommends google-perftools && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
echo LD_PRELOAD=$(find /usr/lib -name libtcmalloc.so.4) >> /etc/environment

ENV venv_dir -

RUN useradd -U --home /stable-diffusion-webui sd

RUN sh -c 'nohup ./webui.sh -f --skip-torch-cuda-test --no-half >/tmp/sd.log &'; \
start=$(date +%s); \
while true; do \
sleep 3; \
if grep -q "Applying attention optimization" /tmp/sd.log; then \
break; \
elif ! ps -ef | grep -q ./webui.sh; then \
cat /tmp/sd.log; \
exit 11; \
else \
echo "[$(($(date +%s)-${start}))s] preparing..."; \
fi; \
done && \
rm -rf /root/.cache /tmp/sd.log && \
chown -R sd:sd /stable-diffusion-webui

EXPOSE 7860

USER sd

ENTRYPOINT ["/usr/local/bin/python", "/stable-diffusion-webui/webui.py"]

CMD ["--listen", "--port", "7860", "--no-download-sd-model"]

0 comments on commit c90c338

Please sign in to comment.