Created
August 26, 2020 14:32
-
-
Save eyablokov/87913449c97bcf38652b3f311365b5c5 to your computer and use it in GitHub Desktop.
Dockerfile
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
# maybe it's expected I mention to use alpine here. I don't think so (can | |
# explain). | |
FROM ubuntu:18.04 | |
# avoid "upgrade", as many of the “essential” packages cannot upgrade inside an | |
# unprivileged container. if there is a particular package, that needs to be | |
# updated, use `apt-get install -y foo` to update automatically. | |
#RUN apt-get upgrade | |
# sort multi-line arguments alphanumerically. this helps to avoid duplication of | |
# packages and makes the list much easier to update. | |
# Always combine `apt-get update` with `apt-get install`, otherwise it causes | |
# caching issues and subsequent `apt-get install` instructions fail. | |
RUN apt-get update && apt-get install -y --no-install-recommends build-essential \ | |
libglib2.0-0 \ | |
libpq-dev \ | |
tzdata \ | |
# clean up the apt cache by removing /var/lib/apt/lists. it reduces the image | |
# size, since the apt cache is not stored in a layer. | |
&& rm -fr /var/lib/apt/lists/* | |
# copy requirements.txt only instead of copying the whole directory. | |
#COPY ./ /repo/ | |
COPY requirements.txt /repo | |
COPY requirements_deploy.txt /repo | |
# install python requirements | |
RUN pip3 install --upgrade pip==19.3.1 | |
RUN pip3 install -r /repo/requirements.txt | |
RUN pip3 install -r /repo/requirements_deploy.txt | |
# set timezone correctly | |
# can be ok, but there are ways of adding "TZ" variable, or using volumes. | |
RUN ln -fs /usr/share/zoneinfo/Europe/Berlin /etc/localtime | |
RUN dpkg-reconfigure --frontend noninteractive tzdata | |
# versioning must be used widely, as much as possible. pip requirements files | |
# must contain not just software, but sticked with versions. `apt-get install`, | |
# too. | |
# if do COPY of folders, use .dockerignore to scope out folders like ".git" and | |
# other "garbage". |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment