Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce the compose image size #129

Merged
merged 1 commit into from
Jun 2, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
28 changes: 13 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ ARG DOCKER_VERSION=19.03.5
ARG PYTHON_VERSION=3.7.5
ARG BUILD_ALPINE_VERSION=3.10
ARG RUNTIME_ALPINE_VERSION=3.10.3
ARG COMPOSE_TAG=1.25.4

FROM docker:${DOCKER_VERSION} AS docker-cli

Expand All @@ -26,31 +27,28 @@ RUN apk add --no-cache \
zlib-dev
ENV BUILD_BOOTLOADER=1

WORKDIR /usr/local/src

ARG COMPOSE_TAG=1.25.4

RUN git clone --branch ${COMPOSE_TAG} --quiet --recurse-submodules https://github.com/docker/compose.git

COPY --from=docker-cli /usr/local/bin/docker /usr/local/bin/docker

WORKDIR /code/

ARG COMPOSE_TAG
RUN git clone --branch ${COMPOSE_TAG} --quiet --recurse-submodules https://github.com/docker/compose.git .

# FIXME(chris-crone): virtualenv 16.3.0 breaks build, force 16.2.0 until fixed
RUN pip install virtualenv==16.2.0
RUN pip install tox==2.9.1

RUN cp /usr/local/src/compose/requirements.txt .
RUN cp /usr/local/src/compose/requirements-dev.txt .
RUN cp /usr/local/src/compose/.pre-commit-config.yaml .
RUN cp /usr/local/src/compose/tox.ini .
RUN cp /usr/local/src/compose/setup.py .
RUN cp /usr/local/src/compose/README.md .
RUN cp -r /usr/local/src/compose/compose compose/
RUN tox --notest
RUN cp -r /usr/local/src/compose/* .
ARG GIT_COMMIT=unknown
ENV DOCKER_COMPOSE_GITSHA=$GIT_COMMIT
RUN script/build/linux-entrypoint
RUN cp docker-compose-entrypoint.sh /usr/local/bin/
ENTRYPOINT ["sh", "/usr/local/bin/docker-compose-entrypoint.sh"]

RUN cp /usr/local/src/compose/docker-compose-entrypoint.sh /usr/local/bin/
FROM alpine:${RUNTIME_ALPINE_VERSION} AS runtime
ARG COMPOSE_TAG
RUN wget https://raw.githubusercontent.com/docker/compose/${COMPOSE_TAG}/docker-compose-entrypoint.sh
RUN cp docker-compose-entrypoint.sh /usr/local/bin/
ENTRYPOINT ["sh", "/usr/local/bin/docker-compose-entrypoint.sh"]
COPY --from=docker-cli /usr/local/bin/docker /usr/local/bin/docker
COPY --from=build /usr/local/bin/docker-compose /usr/local/bin/docker-compose