uniquejava / blog

My notes regarding the vibrating frontend :boom and the plain old java :rofl.
Creative Commons Zero v1.0 Universal
11 stars 5 forks source link

Smaller python docker images #297

Open uniquejava opened 4 years ago

uniquejava commented 4 years ago

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