Skip to content

Commit

Permalink
Add docker configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
Jackenmen committed Mar 25, 2023
1 parent 6c0417a commit b5e9fe0
Show file tree
Hide file tree
Showing 2 changed files with 185 additions and 0 deletions.
144 changes: 144 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
Procfile
fly.toml

# equivalent of .gitignore below

# Byte-compiled / optimized / DLL files
**/__pycache__
**/*.py[cod]
**/*$py.class

# C extensions
**/*.so

# Distribution / packaging
**/.Python
**/build
**/develop-eggs
**/dist
**/downloads
**/eggs
**/.eggs
**/lib
**/lib64
**/parts
**/sdist
**/var
**/wheels
**/pip-wheel-metadata
**/share/python-wheels
**/*.egg-info
**/.installed.cfg
**/*.egg
**/MANIFEST

# 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
**/.nox
**/.coverage
**/.coverage.*
**/.cache
**/nosetests.xml
**/coverage.xml
**/*.cover
**/*.py,cover
**/.hypothesis
**/.pytest_cache

# Translations
**/*.mo
**/*.pot

# Django stuff:
**/*.log
**/local_settings.py
**/db.sqlite3
**/db.sqlite3-journal

# Flask stuff:
**/instance
**/.webassets-cache

# Scrapy stuff:
**/.scrapy

# Sphinx documentation
**/docs/_build

# PyBuilder
**/target

# Jupyter Notebook
**/.ipynb_checkpoints

# IPython
**/profile_default
**/ipython_config.py

# pyenv
**/.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
**/__pypackages__

# Celery stuff
**/celerybeat-schedule
**/celerybeat.pid

# SageMath parsed files
**/*.sage.py

# Environments
**/.env
**/.venv
**/.venvs
**/env
**/venv
**/venvs
**/ENV
**/env.bak
**/venv.bak
**/venvs.bak

# Spyder project settings
**/.spyderproject
**/.spyproject

# Rope project settings
**/.ropeproject

# mkdocs documentation
site

# mypy
**/.mypy_cache
**/.dmypy.json
**/dmypy.json

# Pyre type checker
**/.pyre

# User-specific stuff:
**/.idea
**/*.iws
**/.vscode
**/*.sublime-project
**/*.sublime-workspace
41 changes: 41 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# build stage
FROM python:3.10-bullseye as build

RUN set -x \
&& apt-get update \
&& apt-get install --no-install-recommends -y build-essential git libpq-dev libssl-dev

RUN set -x \
&& python3 -m venv /opt/red-githubbot

ENV PATH="/opt/red-githubbot/bin:${PATH}"

RUN pip --no-cache-dir --disable-pip-version-check install --upgrade pip setuptools wheel

COPY requirements.txt /tmp/requirements.txt

RUN set -x \
&& pip --no-cache-dir --disable-pip-version-check install --no-deps -r /tmp/requirements.txt \
&& pip check \
&& find /opt/red-githubbot -name '*.pyc' -delete


# actual application image
FROM python:3.10-bullseye

ENV PYTHONUNBUFFERED 1
ENV PYTHONPATH /opt/red-githubbot/
ENV PATH="/opt/red-githubbot/bin:${PATH}"

WORKDIR /opt/red-githubbot/src/

RUN set -x \
&& apt-get update \
&& apt-get install --no-install-recommends -y libpq5 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

COPY --from=build /opt/red-githubbot/ /opt/red-githubbot/
COPY . /opt/red-githubbot/src/

ENTRYPOINT python3 -Om red_githubbot

0 comments on commit b5e9fe0

Please sign in to comment.