From 5af6d027c4649879479b2dea726d3cb88ce731c4 Mon Sep 17 00:00:00 2001 From: mikez <11712290+michaelzern@users.noreply.github.com> Date: Thu, 13 Apr 2023 16:00:27 -0500 Subject: [PATCH 1/2] Create docker-image.yml Needs Docker Hub credentials to the GitHub repository secrets (DOCKERHUB_USERNAME and DOCKERHUB_TOKEN). Also needs USER tag to match Docker Hub username. --- .github/workflows/docker-image.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/docker-image.yml diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml new file mode 100644 index 0000000..167acce --- /dev/null +++ b/.github/workflows/docker-image.yml @@ -0,0 +1,27 @@ +name: Docker Image CI + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Docker Buildx + uses: docker/build-push-action@v4 + - name: Login to DockerHub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Build and push + uses: docker/build-push-action@v4 + with: + context: . + file: ./Dockerfile + push: true + tags: USER/sygil-webui:latest From 053a5952b40059927d8590bfb5d8865fbb67d981 Mon Sep 17 00:00:00 2001 From: mikez <11712290+michaelzern@users.noreply.github.com> Date: Thu, 13 Apr 2023 16:04:38 -0500 Subject: [PATCH 2/2] Update Dockerfile Added comments to describe the purpose of each section, combined the RUN commands to create the ~/.streamlit directory and set up credentials.toml in a single step. Needs USER added from docker hub. --- Dockerfile | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1e2fd30..4f35f9b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,27 +1,37 @@ -ARG IMAGE=hlky/sd-webui:base +ARG IMAGE=USER/sd-webui:base +# Use the base image FROM ${IMAGE} +# Set the working directory WORKDIR /workdir +# Use the specified shell SHELL ["/bin/bash", "-c"] +# Set environment variables ENV PYTHONPATH=/sd +# Expose the required port EXPOSE 8501 + +# Copy necessary files and directories COPY ./entrypoint.sh /sd/ COPY ./data/DejaVuSans.ttf /usr/share/fonts/truetype/ -COPY ./data/ /sd/data/ -copy ./images/ /sd/images/ -copy ./scripts/ /sd/scripts/ -copy ./ldm/ /sd/ldm/ -copy ./frontend/ /sd/frontend/ -copy ./configs/ /sd/configs/ -copy ./configs/webui/webui_streamlit.yaml /sd/configs/webui/userconfig_streamlit.yaml -copy ./.streamlit/ /sd/.streamlit/ -copy ./optimizedSD/ /sd/optimizedSD/ -ENTRYPOINT /sd/entrypoint.sh +COPY ./data /sd/data +COPY ./images /sd/images +COPY ./scripts /sd/scripts +COPY ./ldm /sd/ldm +COPY ./frontend /sd/frontend +COPY ./configs /sd/configs +COPY ./configs/webui/webui_streamlit.yaml /sd/configs/webui/userconfig_streamlit.yaml +COPY ./.streamlit /sd/.streamlit +COPY ./optimizedSD /sd/optimizedSD -RUN mkdir -p ~/.streamlit/ -RUN echo "[general]" > ~/.streamlit/credentials.toml -RUN echo "email = \"\"" >> ~/.streamlit/credentials.toml +# Set the entrypoint +ENTRYPOINT ["/sd/entrypoint.sh"] + +# Create .streamlit directory and set up credentials.toml +RUN mkdir -p ~/.streamlit \ + && echo "[general]" > ~/.streamlit/credentials.toml \ + && echo "email = \"\"" >> ~/.streamlit/credentials.toml