-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
52 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,3 +13,4 @@ | |
|
||
# Dependency directories (remove the comment below to include it) | ||
# vendor/ | ||
bin/ |
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 @@ | ||
FROM umputun/baseimage:buildgo-latest as build | ||
|
||
WORKDIR /build | ||
ADD . /build | ||
|
||
RUN \ | ||
version=$(/script/git-rev.sh); \ | ||
echo "version=$version" && \ | ||
export GOFLAGS="-mod=vendor" && \ | ||
echo "linux-amd64" && GOOS=linux GOARCH=amd64 go build -o cronn.linux-amd64 -ldflags "-X main.revision=${version} -s -w" ./app && \ | ||
echo "linux-386" && GOOS=linux GOARCH=386 go build -o cronn.linux-386 -ldflags "-X main.revision=${version} -s -w" ./app && \ | ||
echo "linux-arm" && GOOS=linux GOARCH=arm go build -o cronn.linux-arm -ldflags "-X main.revision=${version} -s -w" ./app && \ | ||
echo "linux-arm64" && GOOS=linux GOARCH=arm64 go build -o cronn.linux-arm64 -ldflags "-X main.revision=${version} -s -w" ./app && \ | ||
echo "windows-amd64" && GOOS=windows GOARCH=amd64 go build -o cronn.windows-amd64.exe -ldflags "-X main.revision=${version} -s -w" ./app && \ | ||
echo "darwin-amd64" && GOOS=darwin GOARCH=amd64 go build -o cronn.darwin-amd64 -ldflags "-X main.revision=${version} -s -w" ./app && \ | ||
echo "freebsd-amd64" && GOOS=freebsd GOARCH=amd64 go build -o cronn.freebsd-amd64 -ldflags "-X main.revision=${version} -s -w" ./app | ||
|
||
RUN \ | ||
apk add --no-cache --update zip && \ | ||
tar cvzf cronn.linux-amd64.tar.gz cronn.linux-amd64 LICENSE README.md && \ | ||
tar cvzf cronn.linux-386.tar.gz cronn.linux-386 LICENSE README.md && \ | ||
tar cvzf cronn.linux-arm.tar.gz cronn.linux-arm LICENSE README.md && \ | ||
tar cvzf cronn.linux-arm64.tar.gz cronn.linux-arm64 LICENSE README.md && \ | ||
tar cvzf cronn.darwin-amd64.tar.gz cronn.darwin-amd64 LICENSE README.md && \ | ||
tar cvzf cronn.freebsd-amd64.tar.gz cronn.freebsd-amd64 LICENSE README.md && \ | ||
zip cronn.windows-amd64.zip cronn.windows-amd64.exe LICENSE README.md | ||
|
||
FROM alpine | ||
COPY --from=build /build/cronn.* /artifacts/ | ||
RUN ls -la /artifacts/* | ||
CMD ["sleep", "100"] |
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,20 @@ | ||
docker: | ||
docker build -t umputun/cronn . | ||
|
||
bin: | ||
docker build -f Dockerfile.artifacts -t cronn.bin . | ||
- @docker rm -f cronn.bin 2>/dev/null || exit 0 | ||
- @mkdir -p bin | ||
docker run -d --name=cronn.bin cronn.bin | ||
docker cp cronn.bin:/artifacts/cronn.linux-amd64.tar.gz bin/cronn.linux-amd64.tar.gz | ||
docker cp cronn.bin:/artifacts/cronn.linux-386.tar.gz bin/cronn.linux-386.tar.gz | ||
docker cp cronn.bin:/artifacts/cronn.linux-arm64.tar.gz bin/cronn.linux-arm64.tar.gz | ||
docker cp cronn.bin:/artifacts/cronn.darwin-amd64.tar.gz bin/cronn.darwin-amd64.tar.gz | ||
docker cp cronn.bin:/artifacts/cronn.freebsd-amd64.tar.gz bin/cronn.freebsd-amd64.tar.gz | ||
docker cp cronn.bin:/artifacts/cronn.windows-amd64.zip bin/cronn.windows-amd64.zip | ||
docker rm -f cronn.bin | ||
|
||
race_test: | ||
cd app && go test -race -mod=vendor -timeout=60s -count 1 ./... | ||
|
||
.PHONY: bin docker |