Skip to content

Smaller python docker images #297

Open

Description

@uniquejava

https://pythonspeed.com/articles/smaller-python-docker-images/

#
# docker build --rm -t awesome .
# docker run --name awesome1 --link=db2inst1:db2inst1 -p 3000:3000 -dt awesome
#
FROM python:3.7-slim

RUN apt-get update && \
  apt-get install -y gcc libxml2 && \
  apt-get clean

WORKDIR /app

# We copy just the requirements.txt first to leverage Docker cache
COPY server/requirements.txt /app
RUN pip install -r requirements.txt

COPY server /app

ENV PORT 3000
EXPOSE 3000

USER root
CMD python server.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions