diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f81841c..e504355 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,29 +1,48 @@ stages: - build + - test + - manifest - deploy +include: + - remote: 'https://gitlab.com/yobasystems/gitlab-ci-templates/raw/master/container_scanning_all_arch.yml' + amd64 postgres build: - stage: yobasystems/alpine-docker:dind + image: yobasystems/alpine-docker:dind stage: build tags: - amd64 + variables: + CI_APPLICATION_REPOSITORY: $CI_REGISTRY_IMAGE/$CI_COMMIT_REF_SLUG + CI_APPLICATION_TAG: $CI_COMMIT_SHA script: + - export COMMIT_TIME=$(git show -s --format=%ct $CI_APPLICATION_TAG) + - echo "$COMMIT_TIME" && echo "$CI_COMMIT_SHORT_SHA" - apk add --update git - echo "$CI_JOB_TOKEN" | docker login -u gitlab-ci-token "$DOCKER_REGISTRY" --password-stdin - - cd alpine-postgres-amd64/ && docker build -t $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:master -t $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:latest -t $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:amd64 . - - docker push $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:master - - docker push $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:latest + - cd alpine-postgres-amd64/ && docker build --build-arg VCS_REF=${CI_COMMIT_SHORT_SHA} --build-arg BUILD_DATE=${COMMIT_TIME} -t $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:amd64 -t $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:x86_64 -t $DOCKER_REGISTRY_DOCKERHUB_REPO:amd64 -t $DOCKER_REGISTRY_DOCKERHUB_REPO:x86_64 -t $DOCKER_REGISTRY_QUAY/$DOCKER_REGISTRY_QUAY_REPO:amd64 -t $DOCKER_REGISTRY_QUAY/$DOCKER_REGISTRY_QUAY_REPO:x86_64 -t ${CI_APPLICATION_REPOSITORY}:${CI_APPLICATION_TAG} . - docker push $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:amd64 + - docker push $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:x86_64 + - echo "$DOCKERHUB_PASSWORD" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin && docker push $DOCKER_REGISTRY_DOCKERHUB_REPO:amd64 + - echo "$DOCKERHUB_PASSWORD" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin && docker push $DOCKER_REGISTRY_DOCKERHUB_REPO:x86_64 + - echo "$QUAY_PASSWORD" | docker login -u "$QUAY_USERNAME" quay.io --password-stdin && docker push $DOCKER_REGISTRY_QUAY/$DOCKER_REGISTRY_QUAY_REPO:amd64 + - echo "$QUAY_PASSWORD" | docker login -u "$QUAY_USERNAME" quay.io --password-stdin && docker push $DOCKER_REGISTRY_QUAY/$DOCKER_REGISTRY_QUAY_REPO:x86_64 + - docker push ${CI_APPLICATION_REPOSITORY}:${CI_APPLICATION_TAG} arm32v7 postgres build: - stage: yobasystems/alpine-docker:armhf-dind + image: yobasystems/alpine-docker:dind stage: build tags: - armhf + variables: + CI_APPLICATION_REPOSITORY: $CI_REGISTRY_IMAGE/$CI_COMMIT_REF_SLUG + CI_APPLICATION_TAG: $CI_COMMIT_SHA script: + - export COMMIT_TIME=$(git show -s --format=%ct $CI_APPLICATION_TAG) + - echo "$COMMIT_TIME" && echo "$CI_COMMIT_SHORT_SHA" - apk add --update git - echo "$CI_JOB_TOKEN" | docker login -u gitlab-ci-token "$DOCKER_REGISTRY" --password-stdin - - cd alpine-postgres-armhf/ && docker build -t $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:arm32v7 -t $DOCKER_REGISTRY_DOCKERHUB_REPO:arm32v7 -t $DOCKER_REGISTRY_QUAY/$DOCKER_REGISTRY_QUAY_REPO:arm32v7 -t $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:armhf -t $DOCKER_REGISTRY_DOCKERHUB_REPO:armhf -t $DOCKER_REGISTRY_QUAY/$DOCKER_REGISTRY_QUAY_REPO:armhf . + - cd alpine-postgres-armhf/ && docker build --build-arg VCS_REF=${CI_COMMIT_SHORT_SHA} --build-arg BUILD_DATE=${COMMIT_TIME} -t $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:arm32v7 -t $DOCKER_REGISTRY_DOCKERHUB_REPO:arm32v7 -t $DOCKER_REGISTRY_QUAY/$DOCKER_REGISTRY_QUAY_REPO:arm32v7 -t $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:armhf -t $DOCKER_REGISTRY_DOCKERHUB_REPO:armhf -t $DOCKER_REGISTRY_QUAY/$DOCKER_REGISTRY_QUAY_REPO:armhf . - docker push $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:arm32v7 - docker push $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:armhf - echo "$DOCKERHUB_PASSWORD" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin && docker push $DOCKER_REGISTRY_DOCKERHUB_REPO:arm32v7 @@ -32,14 +51,19 @@ arm32v7 postgres build: - echo "$QUAY_PASSWORD" | docker login -u "$QUAY_USERNAME" quay.io --password-stdin && docker push $DOCKER_REGISTRY_QUAY/$DOCKER_REGISTRY_QUAY_REPO:armhf arm64v8 postgres build: - stage: yobasystems/alpine-docker:aarch64-dind + image: yobasystems/alpine-docker:dind stage: build tags: - aarch64 + variables: + CI_APPLICATION_REPOSITORY: $CI_REGISTRY_IMAGE/$CI_COMMIT_REF_SLUG + CI_APPLICATION_TAG: $CI_COMMIT_SHA script: + - export COMMIT_TIME=$(git show -s --format=%ct $CI_APPLICATION_TAG) + - echo "$COMMIT_TIME" && echo "$CI_COMMIT_SHORT_SHA" - apk add --update git - echo "$CI_JOB_TOKEN" | docker login -u gitlab-ci-token "$DOCKER_REGISTRY" --password-stdin - - cd alpine-postgres-aarch64/ && docker build -t $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:arm64v8 -t $DOCKER_REGISTRY_DOCKERHUB_REPO:arm64v8 -t $DOCKER_REGISTRY_QUAY/$DOCKER_REGISTRY_QUAY_REPO:arm64v8 -t $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:aarch64 -t $DOCKER_REGISTRY_DOCKERHUB_REPO:aarch64 -t $DOCKER_REGISTRY_QUAY/$DOCKER_REGISTRY_QUAY_REPO:aarch64 . + - cd alpine-postgres-aarch64/ && docker build --build-arg VCS_REF=${CI_COMMIT_SHORT_SHA} --build-arg BUILD_DATE=${COMMIT_TIME} -t $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:arm64v8 -t $DOCKER_REGISTRY_DOCKERHUB_REPO:arm64v8 -t $DOCKER_REGISTRY_QUAY/$DOCKER_REGISTRY_QUAY_REPO:arm64v8 -t $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:aarch64 -t $DOCKER_REGISTRY_DOCKERHUB_REPO:aarch64 -t $DOCKER_REGISTRY_QUAY/$DOCKER_REGISTRY_QUAY_REPO:aarch64 . - docker push $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:arm64v8 - docker push $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:aarch64 - echo "$DOCKERHUB_PASSWORD" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin && docker push $DOCKER_REGISTRY_DOCKERHUB_REPO:arm64v8 @@ -47,22 +71,173 @@ arm64v8 postgres build: - echo "$QUAY_PASSWORD" | docker login -u "$QUAY_USERNAME" quay.io --password-stdin && docker push $DOCKER_REGISTRY_QUAY/$DOCKER_REGISTRY_QUAY_REPO:arm64v8 - echo "$QUAY_PASSWORD" | docker login -u "$QUAY_USERNAME" quay.io --password-stdin && docker push $DOCKER_REGISTRY_QUAY/$DOCKER_REGISTRY_QUAY_REPO:aarch64 -Github Mirror: - stage: deploy +amd64 postgres version build: + image: yobasystems/alpine-docker:dind + stage: build + tags: + - amd64 + variables: + CI_APPLICATION_REPOSITORY: $CI_REGISTRY_IMAGE/$CI_COMMIT_REF_SLUG + CI_APPLICATION_TAG: $CI_COMMIT_SHA + script: + - export COMMIT_TIME=$(git show -s --format=%ct $CI_APPLICATION_TAG) + - echo "$COMMIT_TIME" && echo "$CI_COMMIT_SHORT_SHA" + - apk add --update git + - echo "$CI_JOB_TOKEN" | docker login -u gitlab-ci-token "$DOCKER_REGISTRY" --password-stdin + - cd alpine-postgres-amd64/ && docker build --build-arg VCS_REF=${CI_COMMIT_SHORT_SHA} --build-arg BUILD_DATE=${COMMIT_TIME} -t $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:13.3-amd64 -t $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:13.3-x86_64 -t $DOCKER_REGISTRY_DOCKERHUB_REPO:13.3-amd64 -t $DOCKER_REGISTRY_DOCKERHUB_REPO:13.3-x86_64 -t $DOCKER_REGISTRY_QUAY/$DOCKER_REGISTRY_QUAY_REPO:13.3-amd64 -t $DOCKER_REGISTRY_QUAY/$DOCKER_REGISTRY_QUAY_REPO:13.3-x86_64 . + - docker push $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:13.3-amd64 + - docker push $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:13.3-x86_64 + - echo "$DOCKERHUB_PASSWORD" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin && docker push $DOCKER_REGISTRY_DOCKERHUB_REPO:13.3-amd64 + - echo "$DOCKERHUB_PASSWORD" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin && docker push $DOCKER_REGISTRY_DOCKERHUB_REPO:13.3-x86_64 + - echo "$QUAY_PASSWORD" | docker login -u "$QUAY_USERNAME" quay.io --password-stdin && docker push $DOCKER_REGISTRY_QUAY/$DOCKER_REGISTRY_QUAY_REPO:13.3-amd64 + - echo "$QUAY_PASSWORD" | docker login -u "$QUAY_USERNAME" quay.io --password-stdin && docker push $DOCKER_REGISTRY_QUAY/$DOCKER_REGISTRY_QUAY_REPO:13.3-x86_64 + +arm32v7 postgres version build: + image: yobasystems/alpine-docker:dind + stage: build + tags: + - armhf + variables: + CI_APPLICATION_REPOSITORY: $CI_REGISTRY_IMAGE/$CI_COMMIT_REF_SLUG + CI_APPLICATION_TAG: $CI_COMMIT_SHA + script: + - export COMMIT_TIME=$(git show -s --format=%ct $CI_APPLICATION_TAG) + - echo "$COMMIT_TIME" && echo "$CI_COMMIT_SHORT_SHA" + - apk add --update git + - echo "$CI_JOB_TOKEN" | docker login -u gitlab-ci-token "$DOCKER_REGISTRY" --password-stdin + - cd alpine-postgres-armhf/ && docker build --build-arg VCS_REF=${CI_COMMIT_SHORT_SHA} --build-arg BUILD_DATE=${COMMIT_TIME} -t $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:13.3-arm32v7 -t $DOCKER_REGISTRY_DOCKERHUB_REPO:13.3-arm32v7 -t $DOCKER_REGISTRY_QUAY/$DOCKER_REGISTRY_QUAY_REPO:13.3-arm32v7 -t $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:13.3-armhf -t $DOCKER_REGISTRY_DOCKERHUB_REPO:13.3-armhf -t $DOCKER_REGISTRY_QUAY/$DOCKER_REGISTRY_QUAY_REPO:13.3-armhf . + - docker push $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:13.3-arm32v7 + - docker push $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:13.3-armhf + - echo "$DOCKERHUB_PASSWORD" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin && docker push $DOCKER_REGISTRY_DOCKERHUB_REPO:13.3-arm32v7 + - echo "$DOCKERHUB_PASSWORD" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin && docker push $DOCKER_REGISTRY_DOCKERHUB_REPO:13.3-armhf + - echo "$QUAY_PASSWORD" | docker login -u "$QUAY_USERNAME" quay.io --password-stdin && docker push $DOCKER_REGISTRY_QUAY/$DOCKER_REGISTRY_QUAY_REPO:13.3-arm32v7 + - echo "$QUAY_PASSWORD" | docker login -u "$QUAY_USERNAME" quay.io --password-stdin && docker push $DOCKER_REGISTRY_QUAY/$DOCKER_REGISTRY_QUAY_REPO:13.3-armhf + +arm64v8 postgres version build: + image: yobasystems/alpine-docker:dind + stage: build tags: - - deploy + - aarch64 + variables: + CI_APPLICATION_REPOSITORY: $CI_REGISTRY_IMAGE/$CI_COMMIT_REF_SLUG + CI_APPLICATION_TAG: $CI_COMMIT_SHA script: - - git push --mirror https://$GITHUB_USERNAME:$GITHUB_PASSWORD@$GITHUB_REPO - - git push https://$GITHUB_USERNAME:$GITHUB_PASSWORD@$GITHUB_REPO HEAD:master + - export COMMIT_TIME=$(git show -s --format=%ct $CI_APPLICATION_TAG) + - echo "$COMMIT_TIME" && echo "$CI_COMMIT_SHORT_SHA" + - apk add --update git + - echo "$CI_JOB_TOKEN" | docker login -u gitlab-ci-token "$DOCKER_REGISTRY" --password-stdin + - cd alpine-postgres-aarch64/ && docker build --build-arg VCS_REF=${CI_COMMIT_SHORT_SHA} --build-arg BUILD_DATE=${COMMIT_TIME} -t $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:13.3-arm64v8 -t $DOCKER_REGISTRY_DOCKERHUB_REPO:13.3-arm64v8 -t $DOCKER_REGISTRY_QUAY/$DOCKER_REGISTRY_QUAY_REPO:13.3-arm64v8 -t $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:13.3-aarch64 -t $DOCKER_REGISTRY_DOCKERHUB_REPO:13.3-aarch64 -t $DOCKER_REGISTRY_QUAY/$DOCKER_REGISTRY_QUAY_REPO:13.3-aarch64 . + - docker push $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:13.3-arm64v8 + - docker push $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:13.3-aarch64 + - echo "$DOCKERHUB_PASSWORD" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin && docker push $DOCKER_REGISTRY_DOCKERHUB_REPO:13.3-arm64v8 + - echo "$DOCKERHUB_PASSWORD" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin && docker push $DOCKER_REGISTRY_DOCKERHUB_REPO:13.3-aarch64 + - echo "$QUAY_PASSWORD" | docker login -u "$QUAY_USERNAME" quay.io --password-stdin && docker push $DOCKER_REGISTRY_QUAY/$DOCKER_REGISTRY_QUAY_REPO:13.3-arm64v8 + - echo "$QUAY_PASSWORD" | docker login -u "$QUAY_USERNAME" quay.io --password-stdin && docker push $DOCKER_REGISTRY_QUAY/$DOCKER_REGISTRY_QUAY_REPO:13.3-aarch64 -Bitbucket Mirror: - stage: deploy +gitlab latest manifest creation: + image: yobasystems/alpine-docker:dind + stage: manifest tags: - - deploy + - amd64 + script: + - mkdir /root/.docker + - 'echo -e "{\n \"experimental\": \"enabled\"\n}\n" >> ~/.docker/config.json' + - echo "$CI_JOB_TOKEN" | docker login -u gitlab-ci-token "$DOCKER_REGISTRY" --password-stdin + - docker pull $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:amd64 + - docker pull $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:arm32v7 + - docker pull $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:arm64v8 + - docker manifest create $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:latest $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:amd64 $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:arm32v7 $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:arm64v8 + - docker manifest annotate $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:latest $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:amd64 --os linux --arch amd64 + - docker manifest annotate $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:latest $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:arm32v7 --os linux --arch arm + - docker manifest annotate $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:latest $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:arm64v8 --os linux --arch arm64 + - docker manifest push $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:latest + +dockerhub latest manifest creation: + image: yobasystems/alpine-docker:dind + stage: manifest + tags: + - amd64 + script: + - mkdir /root/.docker + - 'echo -e "{\n \"experimental\": \"enabled\"\n}\n" >> ~/.docker/config.json' + - echo "$DOCKERHUB_PASSWORD" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin + - docker pull $DOCKER_REGISTRY_DOCKERHUB_REPO:amd64 + - docker pull $DOCKER_REGISTRY_DOCKERHUB_REPO:arm32v7 + - docker pull $DOCKER_REGISTRY_DOCKERHUB_REPO:arm64v8 + - docker manifest create $DOCKER_REGISTRY_DOCKERHUB_REPO:latest $DOCKER_REGISTRY_DOCKERHUB_REPO:amd64 $DOCKER_REGISTRY_DOCKERHUB_REPO:arm32v7 $DOCKER_REGISTRY_DOCKERHUB_REPO:arm64v8 + - docker manifest annotate $DOCKER_REGISTRY_DOCKERHUB_REPO:latest $DOCKER_REGISTRY_DOCKERHUB_REPO:amd64 --os linux --arch amd64 + - docker manifest annotate $DOCKER_REGISTRY_DOCKERHUB_REPO:latest $DOCKER_REGISTRY_DOCKERHUB_REPO:arm32v7 --os linux --arch arm + - docker manifest annotate $DOCKER_REGISTRY_DOCKERHUB_REPO:latest $DOCKER_REGISTRY_DOCKERHUB_REPO:arm64v8 --os linux --arch arm64 + - docker manifest push $DOCKER_REGISTRY_DOCKERHUB_REPO:latest + +gitlab version 13.3 manifest creation: + image: yobasystems/alpine-docker:dind + stage: manifest + tags: + - amd64 + script: + - mkdir /root/.docker + - 'echo -e "{\n \"experimental\": \"enabled\"\n}\n" >> ~/.docker/config.json' + - echo "$CI_JOB_TOKEN" | docker login -u gitlab-ci-token "$DOCKER_REGISTRY" --password-stdin + - docker pull $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:13.3-amd64 + - docker pull $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:13.3-arm32v7 + - docker pull $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:13.3-arm64v8 + - docker manifest create $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:13.3 $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:13.3-amd64 $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:13.3-arm32v7 $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:13.3-arm64v8 + - docker manifest annotate $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:13.3 $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:13.3-amd64 --os linux --arch amd64 + - docker manifest annotate $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:13.3 $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:13.3-arm32v7 --os linux --arch arm + - docker manifest annotate $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:13.3 $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:13.3-arm64v8 --os linux --arch arm64 + - docker manifest push $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:13.3 + +dockerhub version 13.3 manifest creation: + image: yobasystems/alpine-docker:dind + stage: manifest + tags: + - amd64 + script: + - mkdir /root/.docker + - 'echo -e "{\n \"experimental\": \"enabled\"\n}\n" >> ~/.docker/config.json' + - echo "$DOCKERHUB_PASSWORD" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin + - docker pull $DOCKER_REGISTRY_DOCKERHUB_REPO:13.3-amd64 + - docker pull $DOCKER_REGISTRY_DOCKERHUB_REPO:13.3-arm32v7 + - docker pull $DOCKER_REGISTRY_DOCKERHUB_REPO:13.3-arm64v8 + - docker manifest create $DOCKER_REGISTRY_DOCKERHUB_REPO:13.3 $DOCKER_REGISTRY_DOCKERHUB_REPO:13.3-amd64 $DOCKER_REGISTRY_DOCKERHUB_REPO:13.3-arm32v7 $DOCKER_REGISTRY_DOCKERHUB_REPO:13.3-arm64v8 + - docker manifest annotate $DOCKER_REGISTRY_DOCKERHUB_REPO:13.3 $DOCKER_REGISTRY_DOCKERHUB_REPO:13.3-amd64 --os linux --arch amd64 + - docker manifest annotate $DOCKER_REGISTRY_DOCKERHUB_REPO:13.3 $DOCKER_REGISTRY_DOCKERHUB_REPO:13.3-arm32v7 --os linux --arch arm + - docker manifest annotate $DOCKER_REGISTRY_DOCKERHUB_REPO:13.3 $DOCKER_REGISTRY_DOCKERHUB_REPO:13.3-arm64v8 --os linux --arch arm64 + - docker manifest push $DOCKER_REGISTRY_DOCKERHUB_REPO:13.3 + +gitlab major version 13 manifest creation: + image: yobasystems/alpine-docker:dind + stage: manifest + tags: + - amd64 + script: + - mkdir /root/.docker + - 'echo -e "{\n \"experimental\": \"enabled\"\n}\n" >> ~/.docker/config.json' + - echo "$CI_JOB_TOKEN" | docker login -u gitlab-ci-token "$DOCKER_REGISTRY" --password-stdin + - docker pull $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:13.3-amd64 + - docker pull $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:13.3-arm32v7 + - docker pull $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:13.3-arm64v8 + - docker manifest create $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:13 $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:13.3-amd64 $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:13.3-arm32v7 $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:13.3-arm64v8 + - docker manifest annotate $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:13 $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:13.3-amd64 --os linux --arch amd64 + - docker manifest annotate $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:13 $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:13.3-arm32v7 --os linux --arch arm + - docker manifest annotate $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:13 $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:13.3-arm64v8 --os linux --arch arm64 + - docker manifest push $DOCKER_REGISTRY/$DOCKER_REGISTRY_REPO:13 + +dockerhub major version 13 manifest creation: + image: yobasystems/alpine-docker:dind + stage: manifest + tags: + - amd64 script: - - mkdir -p ~/.ssh - - echo "$BB_SSH_PRIVATE_KEY" | tr -d '\r' > ~/.ssh/id_rsa - - chmod 600 ~/.ssh/id_rsa - - ssh-keyscan -H 'bitbucket.org' >> ~/.ssh/known_hosts - - git push --mirror git@$BITBUCKET_REPO - - git push git@$BITBUCKET_REPO HEAD:master + - mkdir /root/.docker + - 'echo -e "{\n \"experimental\": \"enabled\"\n}\n" >> ~/.docker/config.json' + - echo "$DOCKERHUB_PASSWORD" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin + - docker pull $DOCKER_REGISTRY_DOCKERHUB_REPO:13.3-amd64 + - docker pull $DOCKER_REGISTRY_DOCKERHUB_REPO:13.3-arm32v7 + - docker pull $DOCKER_REGISTRY_DOCKERHUB_REPO:13.3-arm64v8 + - docker manifest create $DOCKER_REGISTRY_DOCKERHUB_REPO:13 $DOCKER_REGISTRY_DOCKERHUB_REPO:13.3-amd64 $DOCKER_REGISTRY_DOCKERHUB_REPO:13.3-arm32v7 $DOCKER_REGISTRY_DOCKERHUB_REPO:13.3-arm64v8 + - docker manifest annotate $DOCKER_REGISTRY_DOCKERHUB_REPO:13 $DOCKER_REGISTRY_DOCKERHUB_REPO:13.3-amd64 --os linux --arch amd64 + - docker manifest annotate $DOCKER_REGISTRY_DOCKERHUB_REPO:13 $DOCKER_REGISTRY_DOCKERHUB_REPO:13.3-arm32v7 --os linux --arch arm + - docker manifest annotate $DOCKER_REGISTRY_DOCKERHUB_REPO:13 $DOCKER_REGISTRY_DOCKERHUB_REPO:13.3-arm64v8 --os linux --arch arm64 + - docker manifest push $DOCKER_REGISTRY_DOCKERHUB_REPO:13 diff --git a/README.md b/README.md index 7023a0b..e01b400 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,17 @@ # Postgres Docker image running on Alpine Linux -[![Docker Layers](https://img.shields.io/badge/docker%20layers-3-blue.svg?maxAge=2592000?style=flat-square)](https://hub.docker.com/r/yobasystems/alpine-postgres/) [![Docker Size](https://img.shields.io/badge/docker%20size-10%20MB-blue.svg?maxAge=2592000?style=flat-square)](https://hub.docker.com/r/yobasystems/alpine-postgres/) [![Docker Stars](https://img.shields.io/docker/stars/yobasystems/alpine-postgres.svg?maxAge=2592000?style=flat-square)](https://hub.docker.com/r/yobasystems/alpine-postgres/) [![Docker Pulls](https://img.shields.io/docker/pulls/yobasystems/alpine-postgres.svg?maxAge=2592000?style=flat-square)](https://hub.docker.com/r/yobasystems/alpine-postgres/) +[![Docker Automated build](https://img.shields.io/docker/automated/yobasystems/alpine-postgres.svg?style=for-the-badge&logo=docker)](https://hub.docker.com/r/yobasystems/alpine-postgres/) +[![Docker Pulls](https://img.shields.io/docker/pulls/yobasystems/alpine-postgres.svg?style=for-the-badge&logo=docker)](https://hub.docker.com/r/yobasystems/alpine-postgres/) +[![Docker Stars](https://img.shields.io/docker/stars/yobasystems/alpine-postgres.svg?style=for-the-badge&logo=docker)](https://hub.docker.com/r/yobasystems/alpine-postgres/) -[![Alpine Version](https://img.shields.io/badge/alpine%20version-v3.9.0-green.svg?maxAge=2592000?style=flat-square)](http://alpinelinux.org/) [![Postgres Version](https://img.shields.io/badge/Postgres%20version-v11.1-green.svg?maxAge=2592000?style=flat-square)](https://www.postgresql.org/) +[![Alpine Version](https://img.shields.io/badge/Alpine%20version-v3.14.0-green.svg?style=for-the-badge&logo=alpine-linux)](https://alpinelinux.org/) +[![Postgres Version](https://img.shields.io/badge/Postgres%20version-v13.3-green.svg?style=for-the-badge&logo=postgres)](https://www.postgresql.org/) -This Docker image [(yobasystems/alpine-postgres)](https://hub.docker.com/r/yobasystems/alpine-postgres/) is based on the minimal [Alpine Linux](http://alpinelinux.org/) with [Postgres 11.1](https://www.postgresql.org/) object-relational database server. +This Docker image [(yobasystems/alpine-postgres)](https://hub.docker.com/r/yobasystems/alpine-postgres/) is based on the minimal [Alpine Linux](http://alpinelinux.org/) with [Postgres 13.3](https://www.postgresql.org/) object-relational database server. -##### Alpine Version 3.9.0 (Released January 29, 2019) -##### Postgres Version 11.1 +##### Alpine Version 3.14.0 (Released 2021-06-15) +##### Postgres Version 13.3 ---- @@ -22,8 +25,7 @@ PostgreSQL, often simply "Postgres", is an object-relational database management * Minimal size only 10 MB and only 3 layers * Memory usage is minimal on Alpine Linux. -* Postgresql Version 11.1 -* Armv7 (armhf) version with ```:armhf``` tag + ## Architectures @@ -31,15 +33,29 @@ PostgreSQL, often simply "Postgres", is an object-relational database management * ```:arm64v8```, ```:aarch64``` - 64 bit ARM (ARMv8/aarch64) * ```:arm32v7```, ```:armhf``` - 32 bit ARM (ARMv7/armhf) -#### PLEASE CHECK TAGS BELOW FOR SUPPORTED ARCHITECTURES, THE ABOVE IS A LIST OF EXPLANATION +##### PLEASE CHECK TAGS BELOW FOR SUPPORTED ARCHITECTURES, THE ABOVE IS A LIST OF EXPLANATION ## Tags -* ```:latest```, ```:amd64``` latest branch based on amd64 +* ```:latest``` latest branch based (Automatic Architecture Selection) * ```:master``` master branch usually inline with latest -* ```:v0.0.0``` version number related to docker version -* ```:armhf```, ```:arm32v7``` Armv7 based on latest tag but arm architecture +* ```:amd64```, ```:x86_64``` amd64 based on latest tag but amd64 architecture * ```:aarch64```, ```:arm64v8``` Armv8 based on latest tag but arm64 architecture +* ```:armhf```, ```:arm32v7``` Armv7 based on latest tag but arm32 architecture + +## Layers & Sizes + +![Version](https://img.shields.io/badge/version-amd64-blue.svg?style=for-the-badge) +![MicroBadger Layers (tag)](https://img.shields.io/microbadger/layers/yobasystems/alpine-postgres/amd64.svg?style=for-the-badge) +![MicroBadger Size (tag)](https://img.shields.io/microbadger/image-size/yobasystems/alpine-postgres/amd64.svg?style=for-the-badge) + +![Version](https://img.shields.io/badge/version-aarch64-blue.svg?style=for-the-badge) +![MicroBadger Layers (tag)](https://img.shields.io/microbadger/layers/yobasystems/alpine-postgres/aarch64.svg?style=for-the-badge) +![MicroBadger Size (tag)](https://img.shields.io/microbadger/image-size/yobasystems/alpine-postgres/aarch64.svg?style=for-the-badge) + +![Version](https://img.shields.io/badge/version-armhf-blue.svg?style=for-the-badge) +![MicroBadger Layers (tag)](https://img.shields.io/microbadger/layers/yobasystems/alpine-postgres/armhf.svg?style=for-the-badge) +![MicroBadger Size (tag)](https://img.shields.io/microbadger/image-size/yobasystems/alpine-postgres/armhf.svg?style=for-the-badge) ## Volume structure @@ -89,16 +105,40 @@ mysql: restart: always ``` -## Source Repository +## Source Repositories + +* [Github - yobasystems/alpine-postgres](https://github.com/yobasystems/alpine-postgres) + +* [Gitlab - yobasystems/alpine-postgres](https://gitlab.com/yobasystems/alpine-postgres) * [Bitbucket - yobasystems/alpine-postgres](https://bitbucket.org/yobasystems/alpine-postgres/) -* [Github - yobasystems/alpine-postgres](https://github.com/yobasystems/alpine-postgres) + +## Container Registries + +* [Dockerhub - yobasystems/alpine-postgres](https://hub.docker.com/r/yobasystems/alpine-postgres/) + +* [Quay.io - yobasystems/alpine-postgres](https://quay.io/repository/yobasystems/alpine-postgres) + ## Links * [Yoba Systems](https://www.yobasystems.co.uk/) -* [Dockerhub - yobasystems](https://hub.docker.com/u/yobasystems/) +* [Github - Yoba Systems](https://github.com/yobasystems/) + +* [Dockerhub - Yoba Systems](https://hub.docker.com/u/yobasystems/) + +* [Quay.io - Yoba Systems](https://quay.io/organization/yobasystems) + +* [Maintainer - Dominic Taylor](https://github.com/dominictayloruk) + +## Donation + +[![BMAC](https://img.shields.io/badge/BUY%20ME%20A%20COFFEE-£5-blue.svg?style=for-the-badge&logo=buy-me-a-coffee)](https://www.buymeacoffee.com/dominictayloruk?new=1) + +[![BITCOIN](https://img.shields.io/badge/BTC-bc1ql0heex0jxh0yj5cucc83a3x6c6rxuq6x9zk07g-blue.svg?style=for-the-badge&logo=bitcoin)](bitcoin:bc1ql0heex0jxh0yj5cucc83a3x6c6rxuq6x9zk07g) + +[![ETHEREUM](https://img.shields.io/badge/ETH-0x6b707391c60d50E4E414a143446C0b8eF9A2d1c4-blue.svg?style=for-the-badge&logo=ethereum)](https://etherscan.io/address/dominictaylor.eth) -* [Quay.io - yobasystems](https://quay.io/organization/yobasystems) +[![STELLAR](https://img.shields.io/badge/XLM-GAREZZW36KF2IT2EJW6LG5HH4XT3QIMWCHMCGEBC6V3AP3EFJCORRZIY-blue.svg?style=for-the-badge&logo=stellar)](https://keybase.io/dominictayloruk) \ No newline at end of file diff --git a/alpine-postgres-aarch64/Dockerfile b/alpine-postgres-aarch64/Dockerfile index 3435591..dbdbf69 100644 --- a/alpine-postgres-aarch64/Dockerfile +++ b/alpine-postgres-aarch64/Dockerfile @@ -1,12 +1,28 @@ -FROM yobasystems/alpine:3.9.0-aarch64 -LABEL maintainer "Dominic Taylor " architecture="ARM64v8/aarch64" -LABEL postgres-version="11.1" alpine-version="3.9.0" date="11-Feb-2018" +FROM yobasystems/alpine:3.14.0-aarch64 + +ARG BUILD_DATE +ARG VCS_REF + +LABEL maintainer="Dominic Taylor " \ + architecture="arm64v8/aarch64" \ + postgres-version="13.3" \ + alpine-version="3.14.0" \ + build="07-Jul-2021" \ + org.opencontainers.image.title="alpine-postgres" \ + org.opencontainers.image.description="Postgresql Docker image running on Alpine Linux" \ + org.opencontainers.image.authors="Dominic Taylor " \ + org.opencontainers.image.vendor="Yoba Systems" \ + org.opencontainers.image.version="v13.3" \ + org.opencontainers.image.url="https://hub.docker.com/r/yobasystems/alpine-postgres/" \ + org.opencontainers.image.source="https://github.com/yobasystems/alpine-postgres" \ + org.opencontainers.image.revision=$VCS_REF \ + org.opencontainers.image.created=$BUILD_DATE ENV LANG en_GB.utf8 ENV PGDATA /var/lib/postgresql/data RUN apk update && \ - apk add su-exec tzdata libpq postgresql-client postgresql postgresql-contrib && \ + apk add su-exec tzdata libpq postgresql postgresql-url_encode && \ mkdir /docker-entrypoint-initdb.d && \ rm -rf /var/cache/apk/* @@ -15,6 +31,10 @@ VOLUME /var/lib/postgresql/data COPY files/docker-entrypoint.sh / +RUN chmod -R 755 /docker-entrypoint.sh && \ + mkdir -p /run/postgresql && \ + chown postgres: /run/postgresql + ENTRYPOINT ["/docker-entrypoint.sh"] EXPOSE 5432 diff --git a/alpine-postgres-aarch64/files/docker-entrypoint.sh b/alpine-postgres-aarch64/files/docker-entrypoint.sh index acbead5..eee51e9 100644 --- a/alpine-postgres-aarch64/files/docker-entrypoint.sh +++ b/alpine-postgres-aarch64/files/docker-entrypoint.sh @@ -2,7 +2,7 @@ chown -R postgres "$PGDATA" if [ -z "$(ls -A "$PGDATA")" ]; then - gosu postgres initdb + su-exec postgres initdb sed -ri "s/^#(listen_addresses\s*=\s*)\S+/\1'*'/" "$PGDATA"/postgresql.conf : ${POSTGRES_USER:="postgres"} @@ -23,7 +23,7 @@ if [ -z "$(ls -A "$PGDATA")" ]; then if [ "$POSTGRES_DB" != 'postgres' ]; then createSql="CREATE DATABASE $POSTGRES_DB;" - echo $createSql | gosu postgres postgres --single -jE + echo $createSql | su-exec postgres postgres --single -jE echo fi @@ -34,10 +34,10 @@ if [ -z "$(ls -A "$PGDATA")" ]; then fi userSql="$op USER $POSTGRES_USER WITH SUPERUSER $pass;" - echo $userSql | gosu postgres postgres --single -jE + echo $userSql | su-exec postgres postgres --single -jE echo - gosu postgres pg_ctl -D "$PGDATA" \ + su-exec postgres pg_ctl -D "$PGDATA" \ -o "-c listen_addresses=''" \ -w start @@ -51,9 +51,9 @@ if [ -z "$(ls -A "$PGDATA")" ]; then echo done - gosu postgres pg_ctl -D "$PGDATA" -m fast -w stop + su-exec postgres pg_ctl -D "$PGDATA" -m fast -w stop { echo; echo "host all all 0.0.0.0/0 $authMethod"; } >> "$PGDATA"/pg_hba.conf fi -exec gosu postgres "$@" +exec su-exec postgres "$@" diff --git a/alpine-postgres-amd64/Dockerfile b/alpine-postgres-amd64/Dockerfile index 5fe7e79..9da6d57 100644 --- a/alpine-postgres-amd64/Dockerfile +++ b/alpine-postgres-amd64/Dockerfile @@ -1,12 +1,28 @@ -FROM yobasystems/alpine:3.9.0-amd64 -LABEL maintainer "Dominic Taylor " architecture="AMD64/x86_64" -LABEL postgres-version="11.1" alpine-version="3.9.0" date="11-Feb-2018" +FROM yobasystems/alpine:3.14.0-amd64 + +ARG BUILD_DATE +ARG VCS_REF + +LABEL maintainer="Dominic Taylor " \ + architecture="amd64/x86_64" \ + postgres-version="13.3" \ + alpine-version="3.14.0" \ + build="07-Jul-2021" \ + org.opencontainers.image.title="alpine-postgres" \ + org.opencontainers.image.description="Postgresql Docker image running on Alpine Linux" \ + org.opencontainers.image.authors="Dominic Taylor " \ + org.opencontainers.image.vendor="Yoba Systems" \ + org.opencontainers.image.version="v13.3" \ + org.opencontainers.image.url="https://hub.docker.com/r/yobasystems/alpine-postgres/" \ + org.opencontainers.image.source="https://github.com/yobasystems/alpine-postgres" \ + org.opencontainers.image.revision=$VCS_REF \ + org.opencontainers.image.created=$BUILD_DATE ENV LANG en_GB.utf8 ENV PGDATA /var/lib/postgresql/data RUN apk update && \ - apk add su-exec tzdata libpq postgresql-client postgresql postgresql-contrib && \ + apk add su-exec tzdata libpq postgresql postgresql-url_encode && \ mkdir /docker-entrypoint-initdb.d && \ rm -rf /var/cache/apk/* diff --git a/alpine-postgres-armhf/Dockerfile b/alpine-postgres-armhf/Dockerfile index 91fb249..0c0238d 100644 --- a/alpine-postgres-armhf/Dockerfile +++ b/alpine-postgres-armhf/Dockerfile @@ -1,12 +1,28 @@ -FROM yobasystems/alpine:3.9.0-armhf -LABEL maintainer "Dominic Taylor " architecture="ARM32v7/armhf" -LABEL postgres-version="11.1" alpine-version="3.9.0" date="11-Feb-2018" +FROM yobasystems/alpine:3.14.0-armhf + +ARG BUILD_DATE +ARG VCS_REF + +LABEL maintainer="Dominic Taylor " \ + architecture="arm32v7/armhf" \ + postgres-version="13.3" \ + alpine-version="3.14.0" \ + build="07-Jul-2021" \ + org.opencontainers.image.title="alpine-postgres" \ + org.opencontainers.image.description="Postgresql Docker image running on Alpine Linux" \ + org.opencontainers.image.authors="Dominic Taylor " \ + org.opencontainers.image.vendor="Yoba Systems" \ + org.opencontainers.image.version="v13.3" \ + org.opencontainers.image.url="https://hub.docker.com/r/yobasystems/alpine-postgres/" \ + org.opencontainers.image.source="https://github.com/yobasystems/alpine-postgres" \ + org.opencontainers.image.revision=$VCS_REF \ + org.opencontainers.image.created=$BUILD_DATE ENV LANG en_GB.utf8 ENV PGDATA /var/lib/postgresql/data RUN apk update && \ - apk add su-exec tzdata libpq postgresql-client postgresql postgresql-contrib && \ + apk add su-exec tzdata libpq postgresql postgresql-url_encode && \ mkdir /docker-entrypoint-initdb.d && \ rm -rf /var/cache/apk/* @@ -15,6 +31,10 @@ VOLUME /var/lib/postgresql/data COPY files/docker-entrypoint.sh / +RUN chmod -R 755 /docker-entrypoint.sh && \ + mkdir -p /run/postgresql && \ + chown postgres: /run/postgresql + ENTRYPOINT ["/docker-entrypoint.sh"] EXPOSE 5432 diff --git a/alpine-postgres-armhf/files/docker-entrypoint.sh b/alpine-postgres-armhf/files/docker-entrypoint.sh index acbead5..eee51e9 100644 --- a/alpine-postgres-armhf/files/docker-entrypoint.sh +++ b/alpine-postgres-armhf/files/docker-entrypoint.sh @@ -2,7 +2,7 @@ chown -R postgres "$PGDATA" if [ -z "$(ls -A "$PGDATA")" ]; then - gosu postgres initdb + su-exec postgres initdb sed -ri "s/^#(listen_addresses\s*=\s*)\S+/\1'*'/" "$PGDATA"/postgresql.conf : ${POSTGRES_USER:="postgres"} @@ -23,7 +23,7 @@ if [ -z "$(ls -A "$PGDATA")" ]; then if [ "$POSTGRES_DB" != 'postgres' ]; then createSql="CREATE DATABASE $POSTGRES_DB;" - echo $createSql | gosu postgres postgres --single -jE + echo $createSql | su-exec postgres postgres --single -jE echo fi @@ -34,10 +34,10 @@ if [ -z "$(ls -A "$PGDATA")" ]; then fi userSql="$op USER $POSTGRES_USER WITH SUPERUSER $pass;" - echo $userSql | gosu postgres postgres --single -jE + echo $userSql | su-exec postgres postgres --single -jE echo - gosu postgres pg_ctl -D "$PGDATA" \ + su-exec postgres pg_ctl -D "$PGDATA" \ -o "-c listen_addresses=''" \ -w start @@ -51,9 +51,9 @@ if [ -z "$(ls -A "$PGDATA")" ]; then echo done - gosu postgres pg_ctl -D "$PGDATA" -m fast -w stop + su-exec postgres pg_ctl -D "$PGDATA" -m fast -w stop { echo; echo "host all all 0.0.0.0/0 $authMethod"; } >> "$PGDATA"/pg_hba.conf fi -exec gosu postgres "$@" +exec su-exec postgres "$@"