From 9a4ee46e29bb0a52fbc246f49d3b3ff28542c192 Mon Sep 17 00:00:00 2001 From: IMBCIT Date: Sun, 25 Jun 2023 17:30:57 -0700 Subject: [PATCH 1/2] adding new dockerfile images and reqs for celery --- .dockerignore | 105 +++++++++++++++++++++++++++++++++ Dockerfile | 12 ++-- Dockerfile-celery-worker | 12 ++-- docker-compose.mysql.yml.jinja | 6 +- requirements-celery.txt | 14 +++++ 5 files changed, 130 insertions(+), 19 deletions(-) create mode 100644 .dockerignore create mode 100644 requirements-celery.txt diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..7d87c81d4 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,105 @@ +**/.git +**/.github +**/.gitignore +**/.vscode +**/coverage +**/.env +**/.aws +**/.ssh + +Dockerfile +README.md +docker-compose.yml +**/.DS_Store +**/venv +**/env + +# Git +.git +.gitignore +.gitattributes + + +# CI +.codeclimate.yml +.travis.yml +.taskcluster.yml + +# Docker +docker-compose.yml +Dockerfile +.docker +.dockerignore + +# Byte-compiled / optimized / DLL files +**/__pycache__/ +**/*.py[cod] + +# C extensions +*.so + +# Distribution / packaging +.Python +env/ +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +*.egg-info/ +.installed.cfg +*.egg + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.cache +nosetests.xml +coverage.xml + +# Translations +*.mo +*.pot + +# Django stuff: +*.log + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# Virtual environment +.env +.venv/ +venv/ + +# PyCharm +.idea + +# Python mode for VIM +.ropeproject +**/.ropeproject + +# Vim swap files +**/*.swp + +# VS Code +.vscode/ \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index a5f64ca72..72c6c59a6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,19 +1,15 @@ -FROM ubuntu:22.04 +FROM python:3.11.3-slim-bullseye MAINTAINER Iurii Milovanov "duruku@gmail.com" RUN apt-get update && \ apt-get install -y --no-install-recommends \ - python3-pip \ - python3-setuptools \ - curl && \ - python3 -m pip install --upgrade pip - -COPY ./requirements.txt /simoc/requirements.txt -RUN python3 -m pip install -r /simoc/requirements.txt + curl COPY . /simoc +RUN pip install -r /simoc/requirements.txt + ARG DB_TYPE ARG DB_HOST ARG DB_PORT diff --git a/Dockerfile-celery-worker b/Dockerfile-celery-worker index 05d3f5140..557344742 100644 --- a/Dockerfile-celery-worker +++ b/Dockerfile-celery-worker @@ -1,19 +1,15 @@ -FROM ubuntu:22.04 +FROM python:3.11.3-slim-bullseye MAINTAINER Iurii Milovanov "duruku@gmail.com" RUN apt-get update && \ apt-get install -y --no-install-recommends \ - python3-pip \ - python3-setuptools \ - curl && \ - python3 -m pip install --upgrade pip - -COPY ./requirements.txt /simoc/requirements.txt -RUN python3 -m pip install -r /simoc/requirements.txt + curl COPY . /simoc +RUN pip install -r /simoc/requirements-celery.txt + ARG DB_TYPE ARG DB_HOST ARG DB_PORT diff --git a/docker-compose.mysql.yml.jinja b/docker-compose.mysql.yml.jinja index e8af4c21a..548214715 100644 --- a/docker-compose.mysql.yml.jinja +++ b/docker-compose.mysql.yml.jinja @@ -1,7 +1,7 @@ version: '3.6' services: nginx: - image: nginx + image: nginx:1.25-alpine {% if use_certbot %} command: "/bin/sh -c 'while :; do sleep 6h & wait $${!}; nginx -s reload; done & nginx -g \"daemon off;\"'" {% endif %} @@ -57,7 +57,7 @@ services: {% if redis_use_bitnami %} image: bitnami/redis:latest {% else %} - image: redis:latest + image: redis:7.0-alpine {% endif %} restart: always ports: @@ -67,7 +67,7 @@ services: environment: - REDIS_PASSWORD=${REDIS_PASSWORD} {% if not redis_use_bitnami %} - command: ["bash", "-c", 'docker-entrypoint.sh --requirepass $REDIS_PASSWORD'] + command: ["sh", "-c", 'docker-entrypoint.sh --requirepass $REDIS_PASSWORD'] {% endif %} celery-worker: {% if use_dockerhub %} diff --git a/requirements-celery.txt b/requirements-celery.txt new file mode 100644 index 000000000..534560359 --- /dev/null +++ b/requirements-celery.txt @@ -0,0 +1,14 @@ +celery==5.2.7 +flask==2.3.2 +flask-login==0.6.2 +flask_socketio==5.3.2 +flask-sqlalchemy==2.5.1 +jinja2==3.1.2 +mesa==1.1.1 +mysql-connector-python==8.0.32 +numpy==1.24.3 +quantities==0.14.1 +redis==4.5.4 +scikit-learn==1.2.0 +scipy==1.9.3 +sqlalchemy==1.4.46 \ No newline at end of file From bd87eed7272e83affcad60adbf538f2f80a0a822 Mon Sep 17 00:00:00 2001 From: IMBCIT Date: Sun, 9 Jul 2023 16:15:32 -0700 Subject: [PATCH 2/2] reverting COPY to original and removing MAINTAINER --- Dockerfile | 7 +++---- Dockerfile-celery-worker | 10 ++++------ 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index 72c6c59a6..42e0799c8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,14 @@ FROM python:3.11.3-slim-bullseye -MAINTAINER Iurii Milovanov "duruku@gmail.com" - RUN apt-get update && \ apt-get install -y --no-install-recommends \ curl -COPY . /simoc - +COPY ./requirements.txt /simoc/requirements.txt RUN pip install -r /simoc/requirements.txt +COPY . /simoc + ARG DB_TYPE ARG DB_HOST ARG DB_PORT diff --git a/Dockerfile-celery-worker b/Dockerfile-celery-worker index 557344742..496fc225f 100644 --- a/Dockerfile-celery-worker +++ b/Dockerfile-celery-worker @@ -1,15 +1,13 @@ FROM python:3.11.3-slim-bullseye -MAINTAINER Iurii Milovanov "duruku@gmail.com" - RUN apt-get update && \ - apt-get install -y --no-install-recommends \ - curl - -COPY . /simoc + apt-get install -y --no-install-recommends +COPY ./requirements-celery.txt /simoc/requirements-celery.txt RUN pip install -r /simoc/requirements-celery.txt +COPY . /simoc + ARG DB_TYPE ARG DB_HOST ARG DB_PORT