forked from VictoriaMetrics/VictoriaMetrics
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
reworks snap build with docker (VictoriaMetrics#1910)
- Loading branch information
Showing
5 changed files
with
54 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
FROM snapcore/snapcraft:stable | ||
ARG GO_VERSION | ||
RUN apt-get update && apt-get install -y git make wget binutils build-essential bzip2 cpp cpp-5 dpkg-dev fakeroot g++ g++-5 gcc gcc-5 | ||
|
||
RUN cd /usr/local &&\ | ||
wget https://dl.google.com/go/go1.17.3.linux-amd64.tar.gz &&\ | ||
tar -zxvf go$GO_VERSION.linux-amd64.tar.gz && rm go$GO_VERSION.linux-amd64.tar.gz | ||
ENV PATH="/usr/local/go/bin:${PATH}" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
GO_VERSION ?=1.17.3 | ||
SNAP_BUILDER_IMAGE := local/snap-builder:2.0.0-$(shell echo $(GO_VERSION) | tr :/ __) | ||
|
||
|
||
# truncate pkg_tag, snap has limitations for name length | ||
SNAP_TAG := $(shell echo "$(PKG_TAG)" | cut -b1-31 ) | ||
|
||
snap-builder-image: | ||
(docker image ls --format '{{.Repository}}:{{.Tag}}' | grep -q '$(SNAP_BUILDER_IMAGE)$$') \ | ||
|| docker build \ | ||
--build-arg GO_VERSION=$(GO_VERSION) \ | ||
--tag $(SNAP_BUILDER_IMAGE) \ | ||
snap/local | ||
|
||
build-snap: snap-builder-image | ||
docker run --rm \ | ||
--mount type=bind,src="$(shell pwd)",dst=/builder \ | ||
-w /builder \ | ||
--env PKG_TAG=$(SNAP_TAG) \ | ||
$(SNAP_BUILDER_IMAGE) \ | ||
bash -c 'snapcraft clean && snapcraft snap -o bin/' | ||
|
||
release-snap: snap-builder-image build-snap | ||
docker run --rm \ | ||
--mount type=bind,src=${HOME}/.snap,dst=/root/.snap \ | ||
--mount type=bind,src="$(shell pwd)",dst=/builder \ | ||
-w /builder \ | ||
--env PKG_TAG=$(SNAP_TAG) \ | ||
$(SNAP_BUILDER_IMAGE) \ | ||
bash -c 'snapcraft login --with /root/.snap/login.json && snapcraft upload "bin/victoriametrics_$(SNAP_TAG)_multi.snap" --release beta,edge,candidate,stable' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters