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

Add stage with minimal image #187

Merged
merged 1 commit into from
May 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 24 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,23 @@ ENV ASCIIDOCTOR_VERSION=${asciidoctor_version} \
ASCIIDOCTOR_BIBTEX_VERSION=${asciidoctor_bibtex_version}


# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Minimal image with asciidoctor
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

FROM base AS main-minimal
RUN echo "assemble minimal main image" # keep here to help --cache-from along

LABEL MAINTAINERS="Guillaume Scheibel <[email protected]>, Damien DUPORTAL <[email protected]>"

RUN apk add --no-cache \
ruby

RUN gem install --no-document \
"asciidoctor:${ASCIIDOCTOR_VERSION}" \
"asciidoctor-pdf:${ASCIIDOCTOR_PDF_VERSION}"


# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Haskell build for: erd
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
Expand Down Expand Up @@ -50,13 +67,13 @@ RUN cabal v2-update \
# Final image
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

FROM base AS main
RUN echo "building main image" # keep here to help --cache-from along
FROM main-minimal AS main
RUN echo "assemble comprehensive main image" # keep here to help --cache-from along

LABEL MAINTAINERS="Guillaume Scheibel <[email protected]>, Damien DUPORTAL <[email protected]>"

# Installing package required for the runtime of
# any of the asciidoctor-* functionnalities
# Installing packagse required for the runtime of
# any of the asciidoctor-* functionalities
RUN apk add --no-cache \
bash \
curl \
Expand All @@ -71,7 +88,6 @@ RUN apk add --no-cache \
python3 \
py3-pillow \
py3-setuptools \
ruby \
ruby-bigdecimal \
ruby-mathematical \
ruby-rake \
Expand All @@ -81,20 +97,17 @@ RUN apk add --no-cache \
unzip \
which

# Installing Ruby Gems needed in the image
# including asciidoctor itself
# Installing Ruby Gems for additional functionality
RUN apk add --no-cache --virtual .rubymakedepends \
build-base \
libxml2-dev \
ruby-dev \
&& gem install --no-document \
"asciidoctor:${ASCIIDOCTOR_VERSION}" \
"asciidoctor-confluence:${ASCIIDOCTOR_CONFLUENCE_VERSION}" \
"asciidoctor-diagram:${ASCIIDOCTOR_DIAGRAM_VERSION}" \
"asciidoctor-epub3:${ASCIIDOCTOR_EPUB3_VERSION}" \
"asciidoctor-mathematical:${ASCIIDOCTOR_MATHEMATICAL_VERSION}" \
asciimath \
"asciidoctor-pdf:${ASCIIDOCTOR_PDF_VERSION}" \
"asciidoctor-revealjs:${ASCIIDOCTOR_REVEALJS_VERSION}" \
coderay \
epubcheck-ruby:4.2.4.0 \
Expand All @@ -109,8 +122,8 @@ RUN apk add --no-cache --virtual .rubymakedepends \
"asciidoctor-bibtex:${ASCIIDOCTOR_BIBTEX_VERSION}" \
&& apk del -r --no-cache .rubymakedepends

# Installing Python dependencies for additional
# functionnalities as diagrams or syntax highligthing
# Installing Python dependencies for additional functionality
# such as diagrams (blockdiag) or syntax highligthing
RUN apk add --no-cache --virtual .pythonmakedepends \
build-base \
python3-dev \
Expand Down
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ export DOCKER_IMAGE_NAME_TO_TEST \
all: build test README.md

build:
docker build \
--target main-minimal \
--tag="$(DOCKER_IMAGE_NAME_TO_TEST)-minimal" \
--build-arg BUILDKIT_INLINE_CACHE=1 \
--cache-from="$(DOCKER_IMAGE_NAME_TO_TEST)-minimal" \
--file=Dockerfile \
$(CURDIR)/
docker build \
--target build-haskell \
--tag="$(DOCKER_IMAGE_NAME_TO_TEST)-build-haskell" \
Expand All @@ -46,6 +53,7 @@ build:
--target main \
--tag="$(DOCKER_IMAGE_NAME_TO_TEST)" \
--build-arg BUILDKIT_INLINE_CACHE=1 \
--cache-from="$(DOCKER_IMAGE_NAME_TO_TEST)-minimal" \
--cache-from="$(DOCKER_IMAGE_NAME_TO_TEST)-build-haskell" \
--cache-from="$(DOCKER_IMAGE_NAME_TO_TEST)" \
--file=Dockerfile \
Expand Down