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

.ci/write-dockerfile.sh, docker/Dockerfile: Fix Docker warning FromAsCasing #38251

Merged
merged 2 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
18 changes: 9 additions & 9 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 All @@ -77,7 +77,7 @@ case $SYSTEM in
*)
#
# The Ubuntu Docker images are "minimized", meaning that some large
# bits such as documentation has been removed. We have to unminimize
# bits such AS documentation has been removed. We have to unminimize
mkoeppe marked this conversation as resolved.
Show resolved Hide resolved
# once (which reinstalls the full versions of some minimized packages),
# or e.g. the maxima documentation (which we depend on for correct operation)
# will be missing.
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 @@ -262,7 +262,7 @@ esac

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 @@ -295,7 +295,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 @@ -311,7 +311,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 @@ -321,7 +321,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 @@ -331,7 +331,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 @@ -353,7 +353,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
32 changes: 16 additions & 16 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 All @@ -93,13 +93,13 @@ RUN apt-get -qq update \
&& apt-get -qq install -y --no-install-recommends gfortran gcc g++ libstdc++-10-dev sudo openssl \
&& apt-get -qq clean \
&& rm -r /var/lib/apt/lists/*
# Sage refuses to build as root, so we add a "sage" user that can sudo without a password.
# We also want this user at runtime as some commands in sage know about the user that was used during build.
# Sage refuses to build AS root, so we add a "sage" user that can sudo without a password.
# We also want this user at runtime AS some commands in sage know about the user that was used during build.
mkoeppe marked this conversation as resolved.
Show resolved Hide resolved
ARG HOME=/home/sage
RUN adduser --quiet --shell /bin/bash --gecos "Sage user,101,," --disabled-password --home "$HOME" sage \
&& echo "sage ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/01-sage \
&& chmod 0440 /etc/sudoers.d/01-sage
# Run everything from now on as the sage user in sage's home
# Run everything from now on AS the sage user in sage's home
mkoeppe marked this conversation as resolved.
Show resolved Hide resolved
USER sage
ENV HOME $HOME
WORKDIR $HOME
Expand All @@ -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,13 +277,13 @@ 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
# as the ones that are build on GitLab:
# result, the sagemath-dev images that are "build-from-latest" are twice AS big
# AS the ones that are build on GitLab:
mkoeppe marked this conversation as resolved.
Show resolved Hide resolved
# https://github.com/moby/moby/issues/6119#issuecomment-268870519
COPY --chown=sage:sage --from=sagemath-dev-patch $SAGE_ROOT $SAGE_ROOT
ARG ARTIFACT_BASE=source-clean
Expand Down
Loading