Skip to content

Instantly share code, notes, and snippets.

@afonasev
Last active August 29, 2019 11:08
Show Gist options
  • Save afonasev/d95e587aab2ff46ec92415edfd035c16 to your computer and use it in GitHub Desktop.
Save afonasev/d95e587aab2ff46ec92415edfd035c16 to your computer and use it in GitHub Desktop.
Python service Dockerfile
FROM python:3.7-alpine3.9
LABEL maintainer='[email protected]'
LABEL description='Python services base image'
# Don't periodically check PyPI to determine whether a new version of pip is available for download.
ENV PIP_DISABLE_PIP_VERSION_CHECK=on
# Disable package cache.
ENV PIP_NO_CACHE_DIR=off
# Python won’t try to write .pyc files on the import of source modules.
ENV PYTHONDONTWRITEBYTECODE=true
# install a handler for SIGSEGV, SIGFPE, SIGABRT, SIGBUS and SIGILL signals to dump the Python traceback
ENV PYTHONFAULTHANDLER=1
# Force the stdout and stderr streams to be unbuffered.
ENV PYTHONUNBUFFERED=1
RUN apk add --no-cache --update \
bash \
curl \
gcc \
libffi-dev \
make \
musl-dev \
tini \
&& pip install poetry ipython \
&& poetry config settings.virtualenvs.create false
RUN mkdir /app
WORKDIR /app
# https://github.com/krallin/tini
ENTRYPOINT ["/sbin/tini", "--"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment