From ebe5c428729921fce37569958df9158d7789897b Mon Sep 17 00:00:00 2001 From: Ali Moghimi Date: Mon, 23 Oct 2023 11:37:35 +0000 Subject: [PATCH] feat: dockerize the app --- .dockerignore | 21 +++++++++++++++++++++ Dockerfile | 31 +++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..265369c --- /dev/null +++ b/.dockerignore @@ -0,0 +1,21 @@ +__pycache__ +*.pyc +*.pyo +*.pyd +.Python +.env +venv +pip-log.txt +pip-delete-this-directory.txt +.tox +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.log +.git +.mypy_cache +.pytest_cache +.hypothesis \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e8dbb0b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,31 @@ +FROM python:3.10 + +RUN mkdir /opt/app +WORKDIR /opt/app + +RUN apt-get update && apt-get install -y --no-install-recommends \ + unixodbc-dev \ + unixodbc \ + libpq-dev \ + curl \ + && wget http://security.ubuntu.com/ubuntu/pool/main/g/glibc/multiarch-support_2.27-3ubuntu1.5_amd64.deb \ + && apt-get install ./multiarch-support_2.27-3ubuntu1.5_amd64.deb \ + && rm multiarch-support_2.27-3ubuntu1.5_amd64.deb \ + && curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \ + && curl https://packages.microsoft.com/config/ubuntu/18.04/prod.list > /etc/apt/sources.list.d/mssql-release.list \ + && apt-get update \ + && ACCEPT_EULA=Y apt-get install -y msodbcsql17 mssql-tools unixodbc-dev \ + && echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile \ + && echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +ADD requirements.txt . +RUN pip install --no-cache-dir -r requirements.txt + +COPY . . + +RUN useradd -m client +USER client + +CMD [ "python", "main.py" ] \ No newline at end of file