Skip to content

Instantly share code, notes, and snippets.

@milnomada
Last active July 29, 2021 13:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save milnomada/a69280c8e5b06f744534678cf9e37962 to your computer and use it in GitHub Desktop.
Save milnomada/a69280c8e5b06f744534678cf9e37962 to your computer and use it in GitHub Desktop.
Python Socket.io Server Dockerfile
FROM python:3.6.5-slim AS sobase
RUN apt-get clean && apt-get -y update
RUN apt-get -y install python3-dev build-essential
RUN apt-get -y install libssl-dev
RUN mkdir /code
COPY requirements.txt /code
RUN CFLAGS="-I/usr/local/opt/openssl/include" \
LDFLAGS="-L/usr/local/opt/openssl/lib" \
UWSGI_PROFILE_OVERRIDE=ssl=true \
pip3 install uwsgi -I --no-cache-dir
RUN pip install -r /code/requirements.txt --src /usr/local/src
COPY ./app /code/app
COPY ./libs /code/libs
WORKDIR /code
FROM sobase AS socket
CMD uwsgi \
--http11-socket 0.0.0.0:3333 -w app.sosrv:app \
--enable-threads \
--threads 4 \
--log-x-forwarded-for \
--logformat '%(addr) - %(user) [%(ltime)] "%(method) %(uri) %(proto)" %(status) %(size) "%(referer)" "%(uagent)"'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment