diff options
author | Evan Read <eread@gitlab.com> | 2022-06-23 07:53:00 +0300 |
---|---|---|
committer | Russell Dickenson <rdickenson@gitlab.com> | 2022-06-23 07:53:00 +0300 |
commit | c81a3169acf562c1555bf79cef433e3e4d9cc928 (patch) | |
tree | e1ee259481ed67e2cc9be656d8388258e9af1cc8 /latest.Dockerfile | |
parent | cc2ffab014b4f612b0bbb2b8759601f58f2ed69d (diff) |
Move latest.Dockerfile away from deprecated bootstrap image
Diffstat (limited to 'latest.Dockerfile')
-rw-r--r-- | latest.Dockerfile | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/latest.Dockerfile b/latest.Dockerfile index e565ee7e..98cfba58 100644 --- a/latest.Dockerfile +++ b/latest.Dockerfile @@ -4,7 +4,7 @@ # # First use the bootstrap image to build main -FROM registry.gitlab.com/gitlab-org/gitlab-docs:bootstrap as builder +FROM registry.gitlab.com/gitlab-org/gitlab-docs/base:alpine-3.16-ruby-2.7.6-0bc327a4 as builder # Set up needed environment variables that are called with --build-arg when # the Docker image is built (see .gitlab-ci.yml). @@ -15,11 +15,16 @@ ENV CI_COMMIT_REF_NAME ${CI_COMMIT_REF_NAME:-main} # Build the docs from this branch COPY . /source/ +# Copy only the Gemfiles and yarn.lock to install the dependencies +COPY /Gemfile* /source/ +COPY /yarn.lock /source/ +WORKDIR /source + RUN yarn install && \ bundle install && \ bundle exec rake setup_git default && \ bundle exec nanoc compile -VV && \ - /scripts/compress_images.sh /source/public ee # compress images + scripts/compress_images.sh public ee # compress images # Symlink EE to CE # https://gitlab.com/gitlab-org/gitlab-docs/issues/418 @@ -56,10 +61,16 @@ COPY --from=registry.gitlab.com/gitlab-org/gitlab-docs:13.12 ${TARGET} ${TARGET} # changes COPY --from=builder /source/public ${TARGET} -# Since we changed images when we invoked 'FROM nginx:1.12-alpine' above, -# the minify script and binary are not included. Thus, we copy them from the -# previous image (aliased as builder). -COPY --from=builder /scripts/minify* /scripts/ +# Build minifier utility +# Adapted from https://github.com/docker/docker.github.io/blob/publish-tools/Dockerfile.builder +# +FROM golang:1.13-alpine AS minifier +RUN apk add --no-cache git +RUN export GO111MODULE=on \ + && go get -d github.com/tdewolff/minify/v2@latest \ + && go build -v -o /minify github.com/tdewolff/minify/cmd/minify +WORKDIR /source +COPY /scripts/minify* scripts/ # Serve the site (target), which is now all static HTML CMD ["sh", "-c", "echo 'GitLab docs are viewable at: http://0.0.0.0:4000'; exec nginx -g 'daemon off;'"] |