Skip to content

Commit

Permalink
Dockerfile updates as first step for #14
Browse files Browse the repository at this point in the history
  • Loading branch information
blthayer committed Nov 22, 2020
1 parent 341d933 commit b710cf4
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 59 deletions.
38 changes: 14 additions & 24 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,29 +1,19 @@
# Audio files will get mounted via a volume, don't include on build.
# Directories, alphabetically:
.git
.idea
**/.pytest_cache
audio_files
audio_files_normalized
# If you also have a local FFmpeg install, don't include it...
ffmpeg
# No local testing cache or virtual environment:
**/.pytest_cache
venv*
venv
venv36
# No PyCharm or Git stuff.
.idea
.git
# No helper Docker files.
docker_ffmpeg
# Do not include the .ini file to avoid accidental inclusion of API key.
disquip.ini
# No distribution files.
dist
build
disquip_bot.egg-info
# No debug file.
dist
ffmpeg
service
venv
**/venv*

# Files, alphabetically:
**/*.bat
.gitignore
debug.py
# No batch scripts.
*.bat
# No packaging directories.
build
disquip_bot.egg-info
dist
disquip.ini
30 changes: 20 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Multi-stage build:
FROM blthayer/ffmpeg:buster as builder
FROM python:3.8-slim as ffmpegbase
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ffmpeg \
libffi-dev \
libnacl-dev \
python-dev && \
rm -rf /var/lib/apt/lists* && \
apt-get -y autoremove && \
apt-get -y autoclean

FROM ffmpegbase as builder

# Suppress the annoying pip version check and disable caching to
# save space.
Expand All @@ -9,15 +20,13 @@ ENV PIP_DISABLE_PIP_VERSION_CHECK=1 PIP_NO_CACHE_DIR=1
WORKDIR /disquip-bot
COPY . /disquip-bot

# Install requirements, run tests, and then install the package. Since
# we're doing a multi-stage build, we'll run these in their own layers
# to help boost caching.
RUN pip install --no-cache-dir -r requirements.txt
RUN pytest tests --showlocals -v
RUN python setup.py sdist bdist_wheel
# Install requirements, run tests, and then install the package.
RUN pip install --no-cache-dir -r requirements.txt && \
pytest tests --showlocals -v && \
python setup.py sdist bdist_wheel

# Use a trim package to run locally.
FROM blthayer/ffmpeg:slim as runner
# The "runner" will be the final image.
FROM ffmpegbase as runner

# Suppress the annoying pip version check and disable caching to
# save space.
Expand All @@ -27,7 +36,8 @@ ENV PIP_DISABLE_PIP_VERSION_CHECK=1 PIP_NO_CACHE_DIR=1
COPY --from=builder /disquip-bot/dist/*.whl /tmp/

# Install.
RUN pip install /tmp/*.whl && rm -f /tmp/*.whl
RUN pip install /tmp/*.whl && \
rm -f /tmp/*.whl

WORKDIR /disquip-bot

Expand Down
15 changes: 12 additions & 3 deletions Dockerfile-develop
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Development Dockerfile that just installs requirements.
FROM blthayer/ffmpeg:slim
FROM python:3.8-slim

# Suppress the annoying pip version check and disable caching to
# save space.
Expand All @@ -9,5 +9,14 @@ ENV PIP_DISABLE_PIP_VERSION_CHECK=1 PIP_NO_CACHE_DIR=0
WORKDIR /disquip-bot
COPY requirements.txt .

# Install Python requirements.
RUN pip install --no-cache-dir -r requirements.txt
# Install requirements.
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ffmpeg \
libffi-dev \
libnacl-dev \
python-dev && \
rm -rf /var/lib/apt/lists* && \
apt-get -y autoremove && \
apt-get -y autoclean && \
pip install --no-cache-dir -r requirements.txt
11 changes: 0 additions & 11 deletions docker_ffmpeg/Dockerfile-buster

This file was deleted.

11 changes: 0 additions & 11 deletions docker_ffmpeg/Dockerfile-slim

This file was deleted.

0 comments on commit b710cf4

Please sign in to comment.