Update dockerfiles to take advantage of BuildKit.
Some checks failed
format Build format has succeeded
clippy Build clippy has failed
rust-test Build rust-test has succeeded

This commit is contained in:
Tom Alexander 2024-10-20 23:02:02 -04:00
parent d80b473fae
commit a01f78b510
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
7 changed files with 30 additions and 14 deletions

View File

@ -114,6 +114,8 @@ spec:
value: $(params.path-to-dockerfile)
- name: EXTRA_ARGS
value:
- "--opt"
- "target=$(params.target-name)"
- --import-cache
- "type=registry,ref=$(params.image-name):buildcache"
- --export-cache

View File

@ -114,6 +114,8 @@ spec:
value: $(params.path-to-dockerfile)
- name: EXTRA_ARGS
value:
- "--opt"
- "target=$(params.target-name)"
- --import-cache
- "type=registry,ref=$(params.image-name):buildcache"
- --export-cache

View File

@ -114,6 +114,8 @@ spec:
value: $(params.path-to-dockerfile)
- name: EXTRA_ARGS
value:
- "--opt"
- "target=$(params.target-name)"
- --import-cache
- "type=registry,ref=$(params.image-name):buildcache"
- --export-cache

View File

@ -114,6 +114,8 @@ spec:
value: $(params.path-to-dockerfile)
- name: EXTRA_ARGS
value:
- "--opt"
- "target=$(params.target-name)"
- --import-cache
- "type=registry,ref=$(params.image-name):buildcache"
- --export-cache

View File

@ -114,6 +114,8 @@ spec:
value: $(params.path-to-dockerfile)
- name: EXTRA_ARGS
value:
- "--opt"
- "target=$(params.target-name)"
- --import-cache
- "type=registry,ref=$(params.image-name):buildcache"
- --export-cache

View File

@ -1,7 +1,10 @@
FROM rustlang/rust:nightly-alpine3.20 AS builder
# syntax=docker/dockerfile:1
ARG ALPINE_VERSION="3.20"
FROM rustlang/rust:nightly-alpine$ALPINE_VERSION AS builder
RUN apk add --no-cache musl-dev
RUN cargo install --locked --no-default-features --features ci-autoclean cargo-cache
RUN --mount=type=tmpfs,target=/tmp --mount=type=cache,target=/usr/local/cargo/registry,sharing=locked cargo install --locked --no-default-features --features ci-autoclean cargo-cache
RUN rustup component add rustc-codegen-cranelift
FROM builder AS format

View File

@ -1,3 +1,6 @@
# syntax=docker/dockerfile:1
ARG ALPINE_VERSION="3.20"
# ARG EMACS_REPO=https://git.savannah.gnu.org/git/emacs.git
ARG EMACS_REPO=https://code.fizz.buzz/mirror/emacs.git
@ -9,7 +12,7 @@ ARG ORG_MODE_REPO=https://code.fizz.buzz/mirror/org-mode.git
ARG ORG_VERSION=abf5156096c06ee5aa05795c3dc5a065f76ada97
FROM alpine:3.20 AS build
FROM alpine:$ALPINE_VERSION AS build
RUN apk add --no-cache build-base musl-dev git autoconf make texinfo gnutls-dev ncurses-dev gawk libgccjit-dev
@ -28,7 +31,7 @@ RUN make DESTDIR="/root/dist" install
FROM build AS build-org-mode
ARG ORG_VERSION
ARG ORG_MODE_REPO
COPY --from=build-emacs /root/dist/ /
COPY --link --from=build-emacs /root/dist/ /
RUN mkdir /root/dist
# Savannah does not allow fetching specific revisions, so we're going to have to put unnecessary load on their server by cloning main and then checking out the revision we want.
RUN git clone $ORG_MODE_REPO /root/org-mode && git -C /root/org-mode checkout $ORG_VERSION
@ -38,13 +41,13 @@ RUN make compile
RUN make DESTDIR="/root/dist" install
FROM rustlang/rust:nightly-alpine3.20 AS tester
FROM rustlang/rust:nightly-alpine$ALPINE_VERSION AS tester
ENV LANG=en_US.UTF-8
RUN apk add --no-cache musl-dev ncurses gnutls libgccjit
RUN cargo install --locked --no-default-features --features ci-autoclean cargo-cache
RUN --mount=type=tmpfs,target=/tmp --mount=type=cache,target=/usr/local/cargo/registry,sharing=locked cargo install --locked --no-default-features --features ci-autoclean cargo-cache
RUN rustup component add rustc-codegen-cranelift
COPY --from=build-emacs /root/dist/ /
COPY --from=build-org-mode /root/dist/ /
COPY --link --from=build-emacs /root/dist/ /
COPY --link --from=build-org-mode /root/dist/ /
ENTRYPOINT ["cargo", "test"]
@ -117,10 +120,10 @@ RUN rm $LITERATE_BUILD_EMACS_PATH/unused/aws.org
FROM tester as foreign-document
RUN apk add --no-cache bash coreutils
RUN mkdir /foreign_documents
COPY --from=foreign-document-gather /foreign_documents/howardabrams /foreign_documents/howardabrams
COPY --from=foreign-document-gather /foreign_documents/doomemacs /foreign_documents/doomemacs
COPY --from=foreign-document-gather /foreign_documents/worg /foreign_documents/worg
COPY --from=foreign-document-gather /foreign_documents/literate_build_emacs /foreign_documents/literate_build_emacs
COPY --from=build-org-mode /root/org-mode /foreign_documents/org-mode
COPY --from=build-emacs /root/emacs /foreign_documents/emacs
COPY --link --from=foreign-document-gather /foreign_documents/howardabrams /foreign_documents/howardabrams
COPY --link --from=foreign-document-gather /foreign_documents/doomemacs /foreign_documents/doomemacs
COPY --link --from=foreign-document-gather /foreign_documents/worg /foreign_documents/worg
COPY --link --from=foreign-document-gather /foreign_documents/literate_build_emacs /foreign_documents/literate_build_emacs
COPY --link --from=build-org-mode /root/org-mode /foreign_documents/org-mode
COPY --link --from=build-emacs /root/emacs /foreign_documents/emacs
ENTRYPOINT ["cargo", "run", "--bin", "foreign_document_test", "--features", "compare,foreign_document_test", "--profile", "release-lto"]