From 9eb520e16004aa4b07fdb392230850e7e73aa16f Mon Sep 17 00:00:00 2001 From: Stan Soldatov Date: Mon, 27 Jan 2025 19:46:16 +0100 Subject: [PATCH] Docker lite. --- ...build_docker.yml => build_docker_full.yml} | 4 +-- .github/workflows/build_docker_lite.yml | 35 +++++++++++++++++++ Dockerfile_lite | 25 +++++++++++++ 3 files changed, 62 insertions(+), 2 deletions(-) rename .github/workflows/{build_docker.yml => build_docker_full.yml} (87%) create mode 100644 .github/workflows/build_docker_lite.yml create mode 100644 Dockerfile_lite diff --git a/.github/workflows/build_docker.yml b/.github/workflows/build_docker_full.yml similarity index 87% rename from .github/workflows/build_docker.yml rename to .github/workflows/build_docker_full.yml index 016b9159..e4ba2514 100644 --- a/.github/workflows/build_docker.yml +++ b/.github/workflows/build_docker_full.yml @@ -1,4 +1,4 @@ -name: Build and push Docker image +name: Build and push Docker image [FULL] on: release: @@ -17,7 +17,7 @@ jobs: with: script: | const wait = (ms) => new Promise(resolve => setTimeout(resolve, ms)); - await wait(300000); // Wait for 5 minutes (300000 milliseconds) + await wait(300000); // Wait for 5 minutes - name: Login to DockerHub uses: docker/login-action@v2 diff --git a/.github/workflows/build_docker_lite.yml b/.github/workflows/build_docker_lite.yml new file mode 100644 index 00000000..38b6d479 --- /dev/null +++ b/.github/workflows/build_docker_lite.yml @@ -0,0 +1,35 @@ +name: Build and push Docker image [LITE] + +on: + release: + types: [published] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Wait until PyPI release is available + uses: actions/github-script@v3 + with: + script: | + const wait = (ms) => new Promise(resolve => setTimeout(resolve, ms)); + await wait(180000); // Wait for 3 minutes + + - name: Login to DockerHub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push Docker image + uses: docker/build-push-action@v4 + with: + context: . + push: true + tags: | + iwatkot/maps4fs:${{ github.ref_name }}_lite + file: ./Dockerfile_lite \ No newline at end of file diff --git a/Dockerfile_lite b/Dockerfile_lite new file mode 100644 index 00000000..d244859e --- /dev/null +++ b/Dockerfile_lite @@ -0,0 +1,25 @@ +FROM python:3.11-slim-buster + +# Dependencies for opencv. +RUN apt-get update && apt-get install -y \ + libgl1-mesa-dev \ + libglib2.0-0 + +WORKDIR /usr/src/app + +COPY .streamlit /usr/src/app/.streamlit +COPY data /usr/src/app/data +COPY docs /usr/src/app/docs +COPY webui /usr/src/app/webui +COPY requirements.txt /usr/src/app/requirements.txt + +RUN pip install -r requirements.txt + +# Ensure the latest version of maps4fs is installed. +RUN pip install --upgrade maps4fs + +EXPOSE 8501 + +ENV PYTHONPATH .:${PYTHONPATH} +ENV LITEVERSION True +CMD ["streamlit", "run", "./webui/webui.py"] \ No newline at end of file