mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-31 17:59:03 +00:00
421d98b248
The Actions cache of the repository was at 10.24 GB against a quota of 10 GB, so GitHub removed entries by least recent use. The LLVM entries were among the first to go, and CI then built LLVM again although the LLVM version did not change. The Docker buildx layer blobs held 6.0 GB of the quota. All LLVM caches together held 1.97 GB. Move the Docker layer cache to a registry cache in GHCR, which does not use the Actions quota. Both jobs have the necessary permission and login already. Pin the LLVM commit in llvm-version.txt and fetch that commit, in place of a clone of the branch tip tinygo_22.x. Add a hash of that file to each LLVM cache key, so a change of the LLVM version invalidates the caches and no other change does. Also rename the LLVM image tags from llvm-20 to llvm-22.
46 lines
1.1 KiB
Docker
46 lines
1.1 KiB
Docker
# tinygo-llvm stage obtains the llvm source for TinyGo
|
|
FROM golang:1.27 AS tinygo-llvm
|
|
|
|
RUN apt-get update && \
|
|
apt-get install -y apt-utils make cmake clang-17 ninja-build && \
|
|
rm -rf \
|
|
/var/lib/apt/lists/* \
|
|
/var/log/* \
|
|
/var/tmp/* \
|
|
/tmp/*
|
|
|
|
COPY ./GNUmakefile /tinygo/GNUmakefile
|
|
COPY ./make /tinygo/make
|
|
COPY ./llvm-version.txt /tinygo/llvm-version.txt
|
|
|
|
RUN cd /tinygo/ && \
|
|
make llvm-source
|
|
|
|
# tinygo-llvm-build stage build the custom llvm with xtensa support
|
|
FROM tinygo-llvm AS tinygo-llvm-build
|
|
|
|
RUN cd /tinygo/ && \
|
|
make llvm-build
|
|
|
|
# tinygo-compiler-build stage builds the compiler itself
|
|
FROM tinygo-llvm-build AS tinygo-compiler-build
|
|
|
|
COPY . /tinygo
|
|
|
|
# build the compiler and tools
|
|
RUN cd /tinygo/ && \
|
|
git submodule update --init && \
|
|
make gen-device -j4 && \
|
|
make build/release
|
|
|
|
# tinygo-compiler copies the compiler build over to a base Go container (without
|
|
# all the build tools etc).
|
|
FROM golang:1.27 AS tinygo-compiler
|
|
|
|
# Copy tinygo build.
|
|
COPY --from=tinygo-compiler-build /tinygo/build/release/tinygo /tinygo
|
|
|
|
# Configure the container.
|
|
ENV PATH="${PATH}:/tinygo/bin"
|
|
CMD ["tinygo"]
|