Merge branch 'working' into 'master'

Merging tested branch into master

See merge request gitlab-com/alliances/aws/sandbox-projects/minio-arm64!1
This commit is contained in:
Kelly Hair 2020-04-15 15:51:37 +00:00
commit e94472aaca
2 changed files with 126 additions and 0 deletions

87
.gitlab-ci.yml Normal file
View file

@ -0,0 +1,87 @@
# Credit -> https://stackoverflow.com/questions/58600986/gitlab-ci-trying-to-use-docker-buildx-to-build-for-arm64
stages:
- buildx
- deploy
- Weekly buildx
- Weekly deploy
# ----- Ad hoc Builds -----
buildx:
image: docker:19.03-git
stage: 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:
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

39
Dockerfile Normal file
View file

@ -0,0 +1,39 @@
#Pulled from: https://hub.docker.com/r/minio/minio/dockerfile
FROM golang:1.13-alpine
LABEL maintainer="Kelly Hair <khair@gitlab.com>"
ENV GOPATH /go
ENV CGO_ENABLED 0
ENV GO111MODULE on
RUN \
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.10
ENV MINIO_UPDATE off
ENV MINIO_ACCESS_KEY_FILE=access_key \
MINIO_SECRET_KEY_FILE=secret_key \
MINIO_KMS_MASTER_KEY_FILE=kms_master_key \
MINIO_SSE_MASTER_KEY_FILE=sse_master_key
EXPOSE 9000
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' && \
echo 'hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4' >> /etc/nsswitch.conf
ENTRYPOINT ["/usr/bin/docker-entrypoint.sh"]
VOLUME ["/data"]
CMD ["minio"]