Skip to content

Commit

Permalink
fix: reduce docker image size (#301)
Browse files Browse the repository at this point in the history
* fix: reduce docker image size

* fix: suppress docker lint errors
  • Loading branch information
satterly authored Apr 25, 2021
1 parent 236cc65 commit 19f211a
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 14 deletions.
19 changes: 19 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
.dockerignore
.DS_Store
.git
.github
.gitignore
.gitmodules
.idea
.jekyll-metadata
.sass-cache
tests
_site
CONTRIBUTING.md
Dockerfile
Dockerfile.archive
docker-compose.yml
Gemfile
Gemfile.lock
_website*.json
**/pg-data
5 changes: 4 additions & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ jobs:
- name: Docker Lint
id: docker-lint
run: |
docker run --rm -i hadolint/hadolint < Dockerfile
docker run --rm -i ghcr.io/hadolint/hadolint hadolint \
--ignore DL3008 \
--ignore DL3059 \
- < Dockerfile
- name: Run tests
id: smoketest
run: |
Expand Down
38 changes: 25 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.7
FROM python:3.7-slim-buster

ENV PYTHONUNBUFFERED 1
ENV PIP_DISABLE_PIP_VERSION_CHECK=1
Expand All @@ -23,30 +23,42 @@ LABEL org.label-schema.build-date=$BUILD_DATE \

SHELL ["/bin/bash", "-o", "pipefail", "-c"]

RUN curl -fsSL https://nginx.org/keys/nginx_signing.key | apt-key add - && \
echo "deb https://nginx.org/packages/debian/ buster nginx" | tee /etc/apt/sources.list.d/nginx.list

# hadolint ignore=DL3008
RUN curl -fsSL https://www.mongodb.org/static/pgp/server-4.2.asc | apt-key add - && \
echo "deb https://repo.mongodb.org/apt/debian buster/mongodb-org/4.2 main" | tee /etc/apt/sources.list.d/mongodb-org-4.2.list && \
apt-get update && \
RUN apt-get update && \
apt-get install -y --no-install-recommends \
gettext-base \
libffi-dev \
build-essential \
curl \
git \
gnupg2 \
libldap2-dev \
libpq-dev \
libsasl2-dev \
mongodb-org-shell \
nginx \
postgresql-client \
python3-dev \
supervisor \
wget \
xmlsec1 && \
apt-get -y clean && \
apt-get -y autoremove && \
rm -rf /var/lib/apt/lists/*

RUN curl -fsSL https://nginx.org/keys/nginx_signing.key | apt-key add - && \
echo "deb https://nginx.org/packages/debian/ buster nginx" | tee /etc/apt/sources.list.d/nginx.list && \
apt-get update && \
apt-get install -y --no-install-recommends \
nginx && \
apt-get -y clean && \
apt-get -y autoremove && \
rm -rf /var/lib/apt/lists/*

# hadolint ignore=DL3008
RUN curl -fsSL https://www.mongodb.org/static/pgp/server-4.2.asc | apt-key add - && \
echo "deb https://repo.mongodb.org/apt/debian buster/mongodb-org/4.2 main" | tee /etc/apt/sources.list.d/mongodb-org-4.2.list && \
apt-get update && \
apt-get install -y --no-install-recommends \
mongodb-org-shell && \
apt-get -y clean && \
apt-get -y autoremove && \
rm -rf /var/lib/apt/lists/*

COPY requirements*.txt /app/
# hadolint ignore=DL3013
RUN pip install --no-cache-dir pip virtualenv && \
Expand Down

0 comments on commit 19f211a

Please sign in to comment.