trying to use less RUNs / layers, to speed up subsequent builds
This commit is contained in:
35
Dockerfile
35
Dockerfile
@@ -4,31 +4,24 @@ FROM python:latest
|
||||
ARG PA_ID
|
||||
|
||||
WORKDIR /code
|
||||
RUN groupadd -g ${PA_ID} pauser && useradd -r -u ${PA_ID} -g ${PA_ID} pauser
|
||||
|
||||
# do this first, allowing layer / build efficiencies if only code changes...
|
||||
# sudo used in dev container
|
||||
RUN apt-get update && apt-get -y install libpq-dev mediainfo cmake libgl1-mesa-glx libglib2.0-0 libjpeg-turbo-progs ffmpeg git sudo
|
||||
COPY requirements.txt .
|
||||
RUN pip3 install --upgrade pip && pip3 install -r requirements.txt && pip3 install --upgrade pillow
|
||||
|
||||
RUN groupadd -g ${PA_ID} pauser && useradd -r -u ${PA_ID} -g ${PA_ID} pauser
|
||||
|
||||
# NOW, deal with any code changes, and reset the container for 'first run'...
|
||||
COPY . .
|
||||
# be explicity with this special directory, don't presume the COPY . . above
|
||||
# has set things up perfectly from DEV to PROD
|
||||
RUN rm -rf static
|
||||
RUN mkdir -p static/Bin
|
||||
RUN mkdir -p static/Import
|
||||
RUN mkdir -p static/Storage
|
||||
RUN mkdir -p static/Metadata
|
||||
RUN pip3 install --upgrade pip
|
||||
RUN pip3 install -r requirements.txt
|
||||
RUN pip3 install --upgrade pillow --user
|
||||
|
||||
# set up static dir and subdirs
|
||||
RUN mkdir -p static/Bin && mkdir static/Import && mkdir static/Storage && mkdir static/Metadata
|
||||
|
||||
EXPOSE 80
|
||||
RUN cat /dev/urandom | head -c 50 | md5sum | head -c 32 > /code/.sk
|
||||
RUN chmod 600 .sk
|
||||
RUN date > internal/build-date.txt
|
||||
RUN git log -n 15 > internal/git-log.txt
|
||||
RUN ln -s /code/TODO /code/internal/TODO
|
||||
RUN ln -s /code/BUGs /code/internal/BUGs
|
||||
RUN cat /dev/urandom | head -c 50 | md5sum | head -c 32 > /code/.sk && chmod 600 .sk && chown pauser:pauser .sk
|
||||
RUN date > internal/build-date.txt && git log -n 15 > internal/git-log.txt && ln -s /code/TODO /code/internal/TODO && ln -s /code/BUGs /code/internal/BUGs
|
||||
RUN rm -rf .git
|
||||
RUN chown pauser:pauser /code
|
||||
RUN chown pauser:pauser ./static
|
||||
RUN chown pauser:pauser ./static/*
|
||||
RUN chown pauser:pauser /code && chown pauser:pauser ./static && chown pauser:pauser ./static/*
|
||||
|
||||
CMD ["./wrapper.sh"]
|
||||
|
||||
Reference in New Issue
Block a user