Skip to content

Commit

Permalink
gh-38251: .ci/write-dockerfile.sh, docker/Dockerfile: Fix Docker warn…
Browse files Browse the repository at this point in the history
…ing FromAsCasing

    
<!-- ^ Please provide a concise and informative title. -->
<!-- ^ Don't put issue numbers in the title, do this in the PR
description below. -->
<!-- ^ For example, instead of "Fixes #12345" use "Introduce new method
to calculate 1 + 2". -->
<!-- v Describe your changes below in detail. -->
<!-- v Why is this change required? What problem does it solve? -->
<!-- v If this PR resolves an open issue, please link to it here. For
example, "Fixes #12345". -->

Newest versions of Docker buildx give a syntax warning
https://github.com/sagemath/sage/actions/runs/9605919331/job/26494464435
?pr=38227#step:13:194
```
WARN: FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line
5)
```

### :memo: Checklist

<!-- Put an `x` in all the boxes that apply. -->

- [x] The title is concise and informative.
- [x] The description explains in detail what this PR is about.
- [ ] I have linked a relevant issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation and checked the documentation
preview.

### :hourglass: Dependencies

<!-- List all open PRs that this PR logically depends on. For example,
-->
<!-- - #12345: short description why this is a dependency -->
<!-- - #34567: ... -->
    
URL: #38251
Reported by: Matthias Köppe
Reviewer(s): Sebastian Oehms, sebastian-oehms
  • Loading branch information
Release Manager committed Jul 20, 2024
2 parents 0962e0b + b61a9f4 commit 4263cef
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
16 changes: 8 additions & 8 deletions .ci/write-dockerfile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ ADD="ADD $__CHOWN"
RUN=RUN
cat <<EOF
ARG BASE_IMAGE=$(eval echo "${FULL_BASE_IMAGE_AND_TAG}")
FROM \${BASE_IMAGE} as with-system-packages
FROM \${BASE_IMAGE} AS with-system-packages
EOF
case $SYSTEM in
debian*|ubuntu*)
Expand Down Expand Up @@ -199,7 +199,7 @@ EOF
*)
cat <<EOF
ARG BASE_IMAGE
FROM \${BASE_IMAGE} as with-system-packages
FROM \${BASE_IMAGE} AS with-system-packages
EOF
INSTALL=$(sage-print-system-package-command $SYSTEM install " ")
;;
Expand Down Expand Up @@ -268,7 +268,7 @@ fi

cat <<EOF
FROM with-system-packages as bootstrapped
FROM with-system-packages AS bootstrapped
#:bootstrapping:
RUN rm -rf /new /sage/.git
$ADD Makefile VERSION.txt COPYING.txt condarc.yml README.md bootstrap bootstrap-conda configure.ac sage .homebrew-build-env tox.ini Pipfile.m4 .gitignore /new/
Expand Down Expand Up @@ -301,7 +301,7 @@ WORKDIR /sage
ARG BOOTSTRAP="${BOOTSTRAP-./bootstrap}"
$RUN sh -x -c "\${BOOTSTRAP}" $ENDRUN $THEN_SAVE_STATUS
FROM bootstrapped as configured
FROM bootstrapped AS configured
#:configuring:
RUN $CHECK_STATUS_THEN mkdir -p logs/pkgs; rm -f config.log; ln -s logs/pkgs/config.log config.log
ARG CONFIGURE_ARGS="${CONFIGURE_ARGS:---enable-build-as-root}"
Expand All @@ -317,7 +317,7 @@ EOF
fi
cat <<EOF
FROM configured as with-base-toolchain
FROM configured AS with-base-toolchain
# We first compile base-toolchain because otherwise lots of packages are missing their dependency on 'patch'
ARG NUMPROC=8
ENV MAKE="make -j\${NUMPROC}"
Expand All @@ -327,7 +327,7 @@ ENV SAGE_CHECK_PACKAGES="!cython,!r,!python3,!gap,!cysignals,!linbox,!git,!ppl,!
#:toolchain:
$RUN $CHECK_STATUS_THEN make \${USE_MAKEFLAGS} base-toolchain $ENDRUN $THEN_SAVE_STATUS
FROM with-base-toolchain as with-targets-pre
FROM with-base-toolchain AS with-targets-pre
ARG NUMPROC=8
ENV MAKE="make -j\${NUMPROC}"
ARG USE_MAKEFLAGS="-k V=0"
Expand All @@ -337,7 +337,7 @@ ENV SAGE_CHECK_PACKAGES="!cython,!r,!python3,!gap,!cysignals,!linbox,!git,!ppl,!
ARG TARGETS_PRE="all-sage-local"
$RUN $CHECK_STATUS_THEN make SAGE_SPKG="sage-spkg -y -o" \${USE_MAKEFLAGS} \${TARGETS_PRE} $ENDRUN $THEN_SAVE_STATUS
FROM with-targets-pre as with-targets
FROM with-targets-pre AS with-targets
ARG NUMPROC=8
ENV MAKE="make -j\${NUMPROC}"
ARG USE_MAKEFLAGS="-k V=0"
Expand All @@ -359,7 +359,7 @@ RUN cd /new && rm -rf .git && \
ARG TARGETS="build"
$RUN $CHECK_STATUS_THEN make SAGE_SPKG="sage-spkg -y -o" \${USE_MAKEFLAGS} \${TARGETS} $ENDRUN $THEN_SAVE_STATUS
FROM with-targets as with-targets-optional
FROM with-targets AS with-targets-optional
ARG NUMPROC=8
ENV MAKE="make -j\${NUMPROC}"
ARG USE_MAKEFLAGS="-k V=0"
Expand Down
24 changes: 12 additions & 12 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ ARG MAKE_BUILD=make-build
################################################################################
# Image containing the run-time dependencies for Sage #
################################################################################
FROM ubuntu:jammy as run-time-dependencies
FROM ubuntu:jammy AS run-time-dependencies
LABEL maintainer="Erik M. Bray <erik.bray@lri.fr>, Julian Rüth <julian.rueth@fsfe.org>, Sebastian Oehms <seb.oehms@gmail.com>"
# Set sane defaults for common environment variables.
ENV LC_ALL C.UTF-8
Expand Down Expand Up @@ -108,7 +108,7 @@ WORKDIR $HOME
# Image containing everything so that a make in a clone of the Sage repository #
# completes without errors #
################################################################################
FROM run-time-dependencies as build-time-dependencies
FROM run-time-dependencies AS build-time-dependencies
# Install the build time dependencies & git & rdfind
RUN sudo apt-get -qq update \
&& sudo apt-get -qq install -y wget build-essential automake m4 dpkg-dev python3 libssl-dev git rdfind \
Expand All @@ -118,7 +118,7 @@ RUN sudo apt-get -qq update \
################################################################################
# Image with an empty git repository in $SAGE_ROOT. #
################################################################################
FROM build-time-dependencies as source-clean
FROM build-time-dependencies AS source-clean
ARG SAGE_ROOT=/home/sage/sage
RUN mkdir -p "$SAGE_ROOT"
WORKDIR $SAGE_ROOT
Expand All @@ -135,7 +135,7 @@ RUN git remote add upstream https://github.com/sagemath/sage.git
# build is not going to use the build-time-dependencies target but rely on #
# whatever tools are installed in ARTIFACT_BASE. #
################################################################################
FROM $ARTIFACT_BASE as source-from-context
FROM $ARTIFACT_BASE AS source-from-context
WORKDIR $HOME
COPY --chown=sage:sage . sage-context
# Checkout the commit that is checked out in $HOME/sage-context
Expand Down Expand Up @@ -183,7 +183,7 @@ RUN patch -p1 < "$HOME"/sage-context.patch
################################################################################
# Image with a built sage but without sage's documentation. #
################################################################################
FROM source-from-context as make-build
FROM source-from-context AS make-build
# Make sure that the result runs on most CPUs.
ENV SAGE_FAT_BINARY yes
# Just to be sure Sage doesn't try to build its own GCC (even though
Expand All @@ -204,7 +204,7 @@ RUN make build
################################################################################
# Image with a full build of sage and its documentation. #
################################################################################
FROM $MAKE_BUILD as make-all
FROM $MAKE_BUILD AS make-all
# The docbuild needs quite some RAM (as of May 2018). It sometimes calls
# os.fork() to spawn an external program which then exceeds easily the
# overcommit limit of the system (no RAM is actually used, but this limit is
Expand All @@ -218,15 +218,15 @@ RUN make
################################################################################
# Image with a full build of sage, ready to release. #
################################################################################
FROM make-all as make-release
FROM make-all AS make-release
RUN make micro_release

################################################################################
# A releasable (relatively small) image which contains a copy of sage without #
# temporary build artifacts which is set up to start the command line #
# interface if no parameters are passed in. #
################################################################################
FROM run-time-dependencies as sagemath
FROM run-time-dependencies AS sagemath
ARG HOME=/home/sage
ARG SAGE_ROOT=/home/sage/sage
COPY --chown=sage:sage --from=make-release $SAGE_ROOT/ $SAGE_ROOT/
Expand All @@ -244,7 +244,7 @@ CMD ["sage"]
# Image with a full build of sage and its documentation but everything #
# stripped that can be quickly rebuild by make. #
################################################################################
FROM make-all as make-fast-rebuild-clean
FROM make-all AS make-fast-rebuild-clean
# Of course, without site-packages/sage, sage does not start but copying/compiling
# them from build/pkgs/sagelib/src/build is very fast.
RUN make fast-rebuild-clean; \
Expand All @@ -255,7 +255,7 @@ RUN make fast-rebuild-clean; \
# identical to make-fast-rebuild-clean or contains a "patch" which can be used #
# to upgrade ARTIFACT_BASE to make-fast-rebuild-clean. #
################################################################################
FROM make-fast-rebuild-clean as sagemath-dev-patch
FROM make-fast-rebuild-clean AS sagemath-dev-patch
ARG ARTIFACT_BASE=source-clean
ARG SAGE_ROOT=/home/sage/sage
# Build a patch containing of a tar file which contains all the modified files
Expand All @@ -277,12 +277,12 @@ RUN if [ x"$ARTIFACT_BASE" != x"source-clean" ]; then \
# the build artifacts intact so developers can make changes and rebuild #
# quickly #
################################################################################
FROM $ARTIFACT_BASE as sagemath-dev
FROM $ARTIFACT_BASE AS sagemath-dev
ARG SAGE_ROOT=/home/sage/sage
# If docker is backed by aufs, then the following command adds the size of
# ARTIFACT_BASE to the image size. As of mid 2018 this is notably the case with
# the docker instances provided by setup_remote_docker on CircleCI. As a
# result, the sagemath-dev images that are "build-from-latest" are twice as big
# result, the sagemath-dev images that are "build-from-latest" are twice AS big
# as the ones that are build on GitLab:
# https://github.com/moby/moby/issues/6119#issuecomment-268870519
COPY --chown=sage:sage --from=sagemath-dev-patch $SAGE_ROOT $SAGE_ROOT
Expand Down

0 comments on commit 4263cef

Please sign in to comment.