-
-
Notifications
You must be signed in to change notification settings - Fork 24
Refactor docker/Makefile to push images directly to registry
#395
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
Conversation
|
The $ cd docker/
$ make VERSION=$(CRYSTAL_VERSION) TARBALLS=/tmp/workspace/build.POSIX:
.PHONY:
TARBALLS = ./tarballs
BUILD_CONTEXT = ./build
PLATFORMS = linux/amd64,linux/arm64
VERSION = latest
TAG = crystal-lang/crystal:$(VERSION)
all: images smoke-test push
setup: .PHONY
mkdir -p $(BUILD_CONTEXT)
cp $(TARBALLS)/crystal-$(VERSION)-1-linux-x86_64.tar.gz $(BUILD_CONTEXT)/crystal-amd64.tar.gz
cp $(TARBALLS)/crystal-$(VERSION)-1-linux-aarch64.tar.gz $(BUILD_CONTEXT)/crystal-arm64.tar.gz
images: alpine ubuntu 84codes
alpine: setup
docker buildx build alpine.Dockerfile -t $(TAG)-alpine --target runtime --platform $(PLATFORMS) $(BUILD_CONTEXT)
docker buildx build alpine.Dockerfile -t $(TAG)-alpine-build --target build --platform $(PLATFORMS) $(BUILD_CONTEXT)
ubuntu: setup
docker buildx build ubuntu.Dockerfile -t $(TAG)-ubuntu --target runtime --platform $(PLATFORMS) $(BUILD_CONTEXT)
docker buildx build ubuntu.Dockerfile -t $(TAG)-ubuntu-build --target build --platform $(PLATFORMS) $(BUILD_CONTEXT)
84codes: .PHONY
docker buildx build --build-arg crystal_version=$(VERSION) -f alpine-84codes.Dockerfile --platform $(PLATFORMS) -t $(TAG)-alpine-84codes-build .
docker buildx build --build-arg crystal_version=$(VERSION) -f ubuntu-84codes.Dockerfile --platform $(PLATFORMS) -t $(TAG)-ubuntu-84codes-build .
smoke-test: .PHONY
docker run --rm -v $(PWD)/smoke.sh:/smoke.sh -e CRYSTAL_VERSION=$(VERSION) $(TAG)-alpine /smoke.sh $*
docker run --rm -v $(PWD)/smoke.sh:/smoke.sh -e CRYSTAL_VERSION=$(VERSION) $(TAG)-ubuntu /smoke.sh $*
push: .PHONY
docker push $(TAG)-alpine $(TAG)-alpine-build $(TAG)-alpine-84-codes-build
docker push $(TAG)-ubuntu $(TAG)-ubuntu-build $(TAG)-ubuntu-84-codes-build
clean: .PHONY
rm -rf $(BUILD_CONTEXT) |
|
I suppose we could expand the recipes to be less cryptic. |
Co-authored-by: Julien Portalier <julien@portalier.com>
Updates `distribution-scripts` dependency to crystal-lang/distribution-scripts@d1d8657 This includes the following changes: * crystal-lang/distribution-scripts#395
As discussed in #389, exporting the docker images to disk and reimporting them in the next job is very expensive. It should be more efficient to push them directly from the builder job to the registry.
Successful workflow run: https://app.circleci.com/pipelines/github/crystal-lang/crystal/20041/workflows/bcae698e-c557-456d-ad93-b23cf4348786