Skip to content

Instantly share code, notes, and snippets.

@skonik
Last active September 11, 2019 14:59
Show Gist options
  • Save skonik/a27fc05fb41e8dd9031cb4cfe710a957 to your computer and use it in GitHub Desktop.
Save skonik/a27fc05fb41e8dd9031cb4cfe710a957 to your computer and use it in GitHub Desktop.
python3.6 on alpine with pipenv
FROM alpine:3.10
# Install runtime libs
RUN apk add python3=3.6.8-r2 \
libpq \
libjpeg-turbo
# Enable non buffered output into tty
ENV PYTHONUNBUFFERED 1
# Set default lang
ENV LANG C.UTF-8
WORKDIR /app/
COPY Pipfile Pipfile.lock /app/
RUN apk --update --virtual build-deps \ # update index and use virtual deps
add py3-pip \ # pip3
python3-dev=3.6.8-r2 \ # python3.6 with .c headers
build-base \ # gcc + musl-dev(lib-c implementation)
postgresql-dev \ # postgres lib
jpeg-dev zlib-dev \ # pillow deps
&& pip3 install pipenv \
&& pipenv install --system --deploy \ # install into system
&& apk del build-deps \ # delete virtual deps (remove gcc, libc, etc)
&& rm -rf /root/.cache/* # remove pip and pipenv cache
COPY . /app
ENTRYPOINT ["sh", "docker-entrypoint.sh"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment