Created
February 8, 2019 10:29
-
-
Save funkybob/756e1901c541f8f60f06d0e5573f3e79 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM python/3.7 | |
# Install system dev packages | |
RUN apt update -y && \ | |
apt install -y libmariadbclient-dev gcc | |
# Build wheels of all our requirements | |
COPY requirements/requirements.txt requirements/requirements.txt | |
RUN mkdir wheels/ && \ | |
pip install -U pip && \ | |
pip wheel -w wheels/ -r requirements/requirements.txt | |
# Start with a clean image | |
FROM python/3.7 | |
# Only install what we need for runtime | |
RUN apt update -y && \ | |
apt install -y libmariadbclient18 && \ | |
rm -rf /var/cache/apt/* | |
# This last line above cleans up apt's caches, to avoid image bloat | |
# Copy the wheels over from stage 0 | |
COPY --from=0 wheels/ wheels/ | |
RUN pip install -U pip && \ | |
pip install wheels/* && \ | |
rm -rf /root/.cache | |
# Again, remove the .cache to avoid image bloat. YMMV | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment