diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b37096e..94b3e6f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,31 +1,87 @@ -image: egon0/docker-with-buildx-and-git:latest +# Credit -> https://stackoverflow.com/questions/58600986/gitlab-ci-trying-to-use-docker-buildx-to-build-for-arm64 -variables: - DOCKER_HOST: tcp://docker:2375/ - DOCKER_DRIVER: overlay2 - DOCKER_TLS_CERTDIR: "" +stages: + - buildx + - deploy + - Weekly buildx + - Weekly deploy -services: - - docker:dind +# ----- Ad hoc Builds ----- -build: - stage: build +buildx: + image: docker:19.03-git + stage: buildx variables: - IMAGE_TAG: $CI_REGISTRY_IMAGE - D_IMAGE_TAG: egon0/minio-multiarch - D_LATEST_TAG: egon0/minio-multiarch:latest + GIT_STRATEGY: none + artifacts: + paths: + - buildx + expire_in: 3 hour + services: + - docker:19.03-dind script: - - > - apk add --no-cache jq; - LATEST_MINIO_GITHUB=$(wget --quiet "https://api.github.com/repos/minio/minio/releases/latest" -O - | jq -r '.tag_name'); - LATEST_MINIO_DHUB=$(wget -q https://registry.hub.docker.com/v1/repositories/egon0/minio-multiarch/tags -O - | sed -e 's/[][]//g' -e 's/"//g' -e 's/ //g' | tr '}' '\n' | awk -F: '{print $3}' | tail -n1); - if [ "$LATEST_MINIO_GITHUB" != "$LATEST_MINIO_DHUB" ] - then - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY - docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD - docker buildx create --use --name A$CI_COMMIT_SHORT_SHA - docker buildx build --platform $BUILD_PLATFORMS --push -t $IMAGE_TAG:$LATEST_MINIO_GITHUB -t $CI_REGISTRY_IMAGE:latest -t $D_IMAGE_TAG:$LATEST_MINIO_GITHUB -t $D_LATEST_TAG . - else - return 0 - fi + - export DOCKER_BUILDKIT=1 + - git clone git://github.com/docker/buildx ./docker-buildx + - docker build --platform=local -o . ./docker-buildx + only: + changes: + - Dockerfile + - .gitlab-ci.yml +deploy: + image: docker:19.03 + stage: deploy + services: + - name: docker:19.03-dind + command: ["--experimental"] + before_script: + - mkdir -p ~/.docker/cli-plugins + - mv buildx ~/.docker/cli-plugins/docker-buildx + - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes + script: + - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY + - docker buildx create --use --name mybuilder + - docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 --push -t $CI_REGISTRY_IMAGE . + only: + changes: + - Dockerfile + - .gitlab-ci.yml + +# ----- Weekly Build ----- + +weekly:buildx: + image: docker:19.03-git + stage: Weekly buildx + variables: + GIT_STRATEGY: none + artifacts: + paths: + - buildx + expire_in: 3 hour + services: + - docker:19.03-dind + script: + - export DOCKER_BUILDKIT=1 + - git clone git://github.com/docker/buildx ./docker-buildx + - docker build --platform=local -o . ./docker-buildx + only: + - schedules + - master + +weekly:deploy: + image: docker:19.03 + stage: Weekly deploy + services: + - name: docker:19.03-dind + command: ["--experimental"] + before_script: + - mkdir -p ~/.docker/cli-plugins + - mv buildx ~/.docker/cli-plugins/docker-buildx + - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes + script: + - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY + - docker buildx create --use --name mybuilder + - docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 --push -t $CI_REGISTRY_IMAGE . + only: + - schedules + - master \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 3cd9b15..417d312 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,19 +1,20 @@ -FROM golang:1.18-alpine as builder +#Pulled from: https://hub.docker.com/r/minio/minio/dockerfile + +FROM golang:1.13-alpine + +LABEL maintainer="Kelly Hair " -LABEL maintainer="MinIO Inc " ENV GOPATH /go ENV CGO_ENABLED 0 ENV GO111MODULE on RUN \ - apk add --no-cache git jq && \ - git config --global advice.detachedHead false && \ - LATEST_MINIO_GITHUB=$(wget --quiet "https://api.github.com/repos/minio/minio/releases/latest" -O - | jq -r '.tag_name'); \ - git clone https://github.com/minio/minio && cd minio && \ - git checkout "$LATEST_MINIO_GITHUB" && go install -v -ldflags "$(go run buildscripts/gen-ldflags.go)" + apk add --no-cache git && \ + git clone https://github.com/minio/minio && cd minio && \ + go install -v -ldflags "$(go run buildscripts/gen-ldflags.go)" -FROM alpine:3.16 +FROM alpine:3.10 ENV MINIO_UPDATE off ENV MINIO_ACCESS_KEY_FILE=access_key \ @@ -23,9 +24,9 @@ ENV MINIO_ACCESS_KEY_FILE=access_key \ EXPOSE 9000 -COPY --from=builder /go/bin/minio /usr/bin/minio -COPY --from=builder /go/minio/CREDITS /third_party/ -COPY --from=builder /go/minio/dockerscripts/docker-entrypoint.sh /usr/bin/ +COPY --from=0 /go/bin/minio /usr/bin/minio +COPY --from=0 /go/minio/CREDITS /third_party/ +COPY --from=0 /go/minio/dockerscripts/docker-entrypoint.sh /usr/bin/ RUN \ apk add --no-cache ca-certificates 'curl>7.61.0' 'su-exec>=0.2' && \ @@ -35,4 +36,4 @@ ENTRYPOINT ["/usr/bin/docker-entrypoint.sh"] VOLUME ["/data"] -CMD ["minio"] +CMD ["minio"] \ No newline at end of file diff --git a/renovate.json b/renovate.json deleted file mode 100644 index 7190a60..0000000 --- a/renovate.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "$schema": "https://docs.renovatebot.com/renovate-schema.json" -}