diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 70989eb..b965e98 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,17 +3,54 @@ before_script: stages: - build + - build-docker -build-amd64: +build-windows-amd64: + image: golang:alpine + script: + - go get -d + - GOOS=windows go build -o godns.exe + artifacts: + paths: + - godns.exe + +build-linux-amd64: + image: golang:alpine + script: + - go get -d + - GOOS=linux go build -o godns + artifacts: + paths: + - godns + +build-linux-arm: + image: golang:alpine + script: + - go get -d + - GOARCH=arm GOOS=linux go build -o godns-arm + artifacts: + paths: + - godns-arm + +build-linux-arm64: + image: golang + script: + - go get -d + - GOARCH=arm64 GOOS=linux go build -o godns-arm64 + artifacts: + paths: + - godns-arm64 + +build-docker-amd64: image: docker:latest - stage: build + stage: build-docker script: - docker image build -t $CI_REGISTRY_IMAGE:amd64-latest -f docker/Dockerfile . - docker push $CI_REGISTRY_IMAGE:amd64-latest -build-arm: +build-docker-arm: image: docker:latest - stage: build + stage: build-docker script: - mkdir tmp - wget -O tmp/qemu-arm-static https://github.com/multiarch/qemu-user-static/releases/download/v2.12.0/qemu-arm-static @@ -21,9 +58,9 @@ build-arm: - docker image build -t $CI_REGISTRY_IMAGE:arm-latest -f docker/Dockerfile.arm . - docker push $CI_REGISTRY_IMAGE:arm-latest -build-arm64: +build-docker-arm64: image: docker:latest - stage: build + stage: build-docker script: - mkdir tmp - wget -O tmp/qemu-aarch64-static https://github.com/multiarch/qemu-user-static/releases/download/v2.12.0/qemu-aarch64-static diff --git a/docker/Dockerfile b/docker/Dockerfile index 339ade5..de25ead 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,10 +1,3 @@ -FROM golang:alpine as build - -RUN apk --no-cache add git; \ - go get github.com/kenshinx/godns; \ - cd $GOPATH/src/github.com/kenshinx/godns; \ - go build -o /godns - FROM alpine:3.7 MAINTAINER Tyler Stuyfzand @@ -15,5 +8,5 @@ RUN apk --no-cache add tini ENTRYPOINT ["/sbin/tini", "-g", "--"] CMD ["godns"] -COPY --from=build /godns /usr/local/bin/godns +COPY /godns /usr/local/bin/godns RUN chmod +x /usr/local/bin/godns diff --git a/docker/Dockerfile.arm b/docker/Dockerfile.arm index a2ac7e2..60d7b98 100644 --- a/docker/Dockerfile.arm +++ b/docker/Dockerfile.arm @@ -1,12 +1,3 @@ -FROM golang:alpine as build - -ENV GOARCH=arm - -RUN apk --no-cache add git; \ - go get github.com/kenshinx/godns; \ - cd $GOPATH/src/github.com/kenshinx/godns; \ - go build -o /godns - FROM arm32v6/alpine COPY tmp/qemu-arm-static /usr/bin/qemu-arm-static @@ -19,5 +10,5 @@ RUN apk --no-cache add tini ENTRYPOINT ["/sbin/tini", "-g", "--"] CMD ["godns"] -COPY --from=build /godns /usr/local/bin/godns +COPY /godns-arm /usr/local/bin/godns RUN chmod +x /usr/local/bin/godns diff --git a/docker/Dockerfile.arm64 b/docker/Dockerfile.arm64 index f1f1af9..a25ae75 100644 --- a/docker/Dockerfile.arm64 +++ b/docker/Dockerfile.arm64 @@ -1,12 +1,3 @@ -FROM golang:alpine as build - -ENV GOARCH=arm64 - -RUN apk --no-cache add git; \ - go get github.com/kenshinx/godns; \ - cd $GOPATH/src/github.com/kenshinx/godns; \ - go build -o /godns - FROM arm64v8/alpine COPY tmp/qemu-aarch64-static /usr/bin/qemu-aarch64-static @@ -19,5 +10,5 @@ RUN apk --no-cache add tini ENTRYPOINT ["/sbin/tini", "-g", "--"] CMD ["godns"] -COPY --from=build /godns /usr/local/bin/godns +COPY /godns-arm64 /usr/local/bin/godns RUN chmod +x /usr/local/bin/godns