Merge pull request #19791 from dvdksn/dockerfile-lint-fromascasing

fix(lint): Dockerfile FromAsCasing
This commit is contained in:
David Karlsson 2024-04-17 10:49:22 +02:00 committed by GitHub
commit 56ab331c8f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 15 additions and 15 deletions

View File

@ -3,41 +3,41 @@
ARG GO_VERSION=1.21
ARG HTMLTEST_VERSION=0.17.0
FROM golang:${GO_VERSION}-alpine as base
FROM golang:${GO_VERSION}-alpine AS base
WORKDIR /src
RUN apk --update add nodejs npm git gcompat
FROM base as node
FROM base AS node
COPY package*.json .
ENV NODE_ENV=production
RUN npm install
FROM base as hugo
FROM base AS hugo
ARG HUGO_VERSION=0.122.0
ARG TARGETARCH
WORKDIR /tmp/hugo
RUN wget -O "hugo.tar.gz" "https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-${TARGETARCH}.tar.gz"
RUN tar -xf "hugo.tar.gz" hugo
FROM base as build-base
FROM base AS build-base
COPY --from=hugo /tmp/hugo/hugo /bin/hugo
COPY --from=node /src/node_modules /src/node_modules
COPY . .
FROM build-base as dev
FROM build-base AS dev
FROM build-base as build
FROM build-base AS build
ARG HUGO_ENV
ARG DOCS_URL
RUN hugo --gc --minify -d /out -e $HUGO_ENV -b $DOCS_URL
FROM scratch as release
FROM scratch AS release
COPY --from=build /out /
FROM scratch as update-stats
FROM scratch AS update-stats
COPY --from=build /src/hugo_stats.json /hugo_stats.json
FROM build as validate-stats
FROM build AS validate-stats
RUN <<EOF
if [ -n "$(git status --porcelain -- hugo_stats.json)" ]; then
echo >&2 'ERROR: hugo_stats.json differs. Update with `docker buildx bake update-stats`'
@ -45,7 +45,7 @@ if [ -n "$(git status --porcelain -- hugo_stats.json)" ]; then
fi
EOF
FROM davidanson/markdownlint-cli2:v0.12.1 as lint
FROM davidanson/markdownlint-cli2:v0.12.1 AS lint
USER root
RUN --mount=type=bind,target=. \
/usr/local/bin/markdownlint-cli2 \
@ -53,13 +53,13 @@ RUN --mount=type=bind,target=. \
"#content/engine/release-notes/*.md" \
"#content/desktop/previous-versions/*.md"
FROM wjdp/htmltest:v${HTMLTEST_VERSION} as test
FROM wjdp/htmltest:v${HTMLTEST_VERSION} AS test
WORKDIR /test
COPY --from=build /out ./public
ADD .htmltest.yml .htmltest.yml
RUN htmltest
FROM build-base as update-modules
FROM build-base AS update-modules
ARG MODULE
RUN <<"EOT"
set -ex
@ -73,18 +73,18 @@ fi
EOT
RUN hugo mod vendor
FROM scratch as vendor
FROM scratch AS vendor
COPY --from=update-modules /src/_vendor /_vendor
COPY --from=update-modules /src/go.* /
FROM build-base as build-upstream
FROM build-base AS build-upstream
ARG UPSTREAM_MODULE_NAME
ARG UPSTREAM_REPO
ARG UPSTREAM_COMMIT
ENV HUGO_MODULE_REPLACEMENTS="github.com/${UPSTREAM_MODULE_NAME} -> github.com/${UPSTREAM_REPO} ${UPSTREAM_COMMIT}"
RUN hugo --ignoreVendorPaths "github.com/${UPSTREAM_MODULE_NAME}" -d /out
FROM wjdp/htmltest:v${HTMLTEST_VERSION} as validate-upstream
FROM wjdp/htmltest:v${HTMLTEST_VERSION} AS validate-upstream
WORKDIR /test
COPY --from=build-upstream /out ./public
ADD .htmltest.yml .htmltest.yml