Skip to content

Instantly share code, notes, and snippets.

@Midnighter
Created August 19, 2018 18:48
Show Gist options
  • Save Midnighter/44c5613121bc3a19064d209b8343d6e1 to your computer and use it in GitHub Desktop.
Save Midnighter/44c5613121bc3a19064d209b8343d6e1 to your computer and use it in GitHub Desktop.
A basic docker image definition for running API Star with gunicorn and uvicorn workers.
FROM python:3.6-slim
ENV PYTHONUNBUFFERED=1
RUN mkdir -p /app
WORKDIR /app
COPY Pipfile* ./
RUN set -eux \
&& apt-get update \
&& apt-get install --yes --only-upgrade openssl ca-certificates \
&& apt-get install --yes --no-install-recommends \
build-essential \
&& pip install --upgrade pip setuptools wheel pipenv \
&& pipenv install --system --dev --deploy \
&& rm -rf /root/.cache/pip \
&& apt-get purge --yes build-essential \
&& apt-get autoremove --yes \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
COPY app.py /app/
CMD ["gunicorn", "app:app", "-b", "0.0.0.0", "-w", "3", "-k", "uvicorn.workers.UvicornWorker"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment