Gitlab CI!

This commit is contained in:
Tyler 2018-06-30 23:09:52 -04:00
parent a6f6c4e96d
commit 63ce0cde19
4 changed files with 97 additions and 0 deletions

32
.gitlab-ci.yml Normal file
View File

@ -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

19
docker/Dockerfile Normal file
View File

@ -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 <tyler@tystuyfzand.com>
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

23
docker/Dockerfile.arm Normal file
View File

@ -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 <tyler@tystuyfzand.com>
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

23
docker/Dockerfile.arm64 Normal file
View File

@ -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 <tyler@tystuyfzand.com>
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