diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..70989eb --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,32 @@ +before_script: + - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY + +stages: + - build + +build-amd64: + image: docker:latest + stage: build + script: + - docker image build -t $CI_REGISTRY_IMAGE:amd64-latest -f docker/Dockerfile . + - docker push $CI_REGISTRY_IMAGE:amd64-latest + +build-arm: + image: docker:latest + stage: build + script: + - mkdir tmp + - wget -O tmp/qemu-arm-static https://github.com/multiarch/qemu-user-static/releases/download/v2.12.0/qemu-arm-static + - chmod +x tmp/qemu-arm-static + - docker image build -t $CI_REGISTRY_IMAGE:arm-latest -f docker/Dockerfile.arm . + - docker push $CI_REGISTRY_IMAGE:arm-latest + +build-arm64: + image: docker:latest + stage: build + script: + - mkdir tmp + - wget -O tmp/qemu-aarch64-static https://github.com/multiarch/qemu-user-static/releases/download/v2.12.0/qemu-aarch64-static + - chmod +x tmp/qemu-aarch64-static + - docker image build -t $CI_REGISTRY_IMAGE:arm64-latest -f docker/Dockerfile.arm64 . + - docker push $CI_REGISTRY_IMAGE:arm64-latest diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..339ade5 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,19 @@ +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 + +EXPOSE 53 + +RUN apk --no-cache add tini +ENTRYPOINT ["/sbin/tini", "-g", "--"] +CMD ["godns"] + +COPY --from=build /godns /usr/local/bin/godns +RUN chmod +x /usr/local/bin/godns diff --git a/docker/Dockerfile.arm b/docker/Dockerfile.arm new file mode 100644 index 0000000..a2ac7e2 --- /dev/null +++ b/docker/Dockerfile.arm @@ -0,0 +1,23 @@ +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 + +MAINTAINER Tyler Stuyfzand + +EXPOSE 53 + +RUN apk --no-cache add tini +ENTRYPOINT ["/sbin/tini", "-g", "--"] +CMD ["godns"] + +COPY --from=build /godns /usr/local/bin/godns +RUN chmod +x /usr/local/bin/godns diff --git a/docker/Dockerfile.arm64 b/docker/Dockerfile.arm64 new file mode 100644 index 0000000..f1f1af9 --- /dev/null +++ b/docker/Dockerfile.arm64 @@ -0,0 +1,23 @@ +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 + +MAINTAINER Tyler Stuyfzand + +EXPOSE 53 + +RUN apk --no-cache add tini +ENTRYPOINT ["/sbin/tini", "-g", "--"] +CMD ["godns"] + +COPY --from=build /godns /usr/local/bin/godns +RUN chmod +x /usr/local/bin/godns