php/.gitlab-ci.yml

117 lines
3.6 KiB
YAML
Raw Normal View History

2017-12-07 04:19:02 +00:00
image: docker:latest
stages:
- build
- build-manifest
2020-08-23 02:54:50 +00:00
- build-test
- build-manifest-test
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- docker/
2017-12-07 04:19:02 +00:00
variables:
BRANCH: alpine
2022-07-30 00:51:02 +00:00
VERSION: 8.1-fpm-${BRANCH}
DOCKER_HOST: tcp://docker:2375
VERSIONARCH: ${VERSION}-${ARCH}
2017-12-07 04:19:02 +00:00
services:
- docker:dind
2017-12-07 04:19:02 +00:00
before_script:
- sed -ie s'/https/http/' /etc/apk/repositories
- HTTP_PROXY=http://proxy.dege.lan:3128 apk add git curl
2017-12-07 04:19:02 +00:00
- docker info
- docker version
- env|sort
# docker login -u "$CI_DEPENDENCY_PROXY_USER" -p "$CI_DEPENDENCY_PROXY_PASSWORD" "$CI_SERVER_HOST"
2018-02-27 08:53:56 +00:00
- echo "$CI_JOB_TOKEN" | docker login -u "$CI_REGISTRY_USER" "$CI_REGISTRY" --password-stdin
2017-12-07 04:19:02 +00:00
x86_64:build:
variables:
ARCH: x86_64
2017-12-07 04:19:02 +00:00
stage: build
script:
2018-02-27 08:53:56 +00:00
- if [ -f init ]; then chmod 500 init; fi
- ([ -z "$REFRESH" -a -f docker/${CI_COMMIT_REF_SLUG} ]) && docker load < docker/${CI_COMMIT_REF_SLUG} || true
- docker build --build-arg HTTP_PROXY=http://proxy.dege.lan:3128 --cache-from ${CI_REGISTRY_IMAGE}:${VERSIONARCH} -t ${CI_REGISTRY_IMAGE}:${VERSIONARCH} .
- docker push ${CI_REGISTRY_IMAGE}:${VERSIONARCH}
- docker save ${CI_REGISTRY_IMAGE}:${VERSIONARCH} > docker/${CI_COMMIT_REF_SLUG}
# apk add curl && curl -LX POST --post301 -F token=${TRIGGER_TOKEN} -F ref=image ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/trigger/pipeline
# apk add curl && curl -LX POST --post301 -F token=${TRIGGER_TOKEN} -F ref=server ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/trigger/pipeline
2017-12-07 04:19:02 +00:00
tags:
- docker
- x86_64
2017-12-07 04:19:02 +00:00
only:
- alpine
2020-08-23 02:54:50 +00:00
x86_64:build-test:
variables:
ARCH: x86_64
2020-08-23 02:54:50 +00:00
stage: build-test
script:
- docker build --build-arg HTTP_PROXY=http://proxy.dege.lan:3128 --file Dockerfile.phptest -t ${CI_REGISTRY_IMAGE}:${VERSIONARCH}-test .
- docker push ${CI_REGISTRY_IMAGE}:${VERSIONARCH}-test
tags:
- docker
- x86_64
only:
- alpine
armv7l:build:
variables:
ARCH: armv7l
stage: build
script:
2020-08-23 02:54:50 +00:00
- if [ -f init ]; then chmod 500 init; fi
- ([ -z "$REFRESH" -a -f docker/${CI_COMMIT_REF_SLUG} ]) && docker load < docker/${CI_COMMIT_REF_SLUG} || true
- docker build --build-arg HTTP_PROXY=http://proxy.dege.lan:3128 --cache-from ${CI_REGISTRY_IMAGE}:${VERSIONARCH} -t ${CI_REGISTRY_IMAGE}:${VERSIONARCH} .
- docker push ${CI_REGISTRY_IMAGE}:${VERSIONARCH}
- docker save ${CI_REGISTRY_IMAGE}:${VERSIONARCH} > docker/${CI_COMMIT_REF_SLUG}
# apk add curl && curl -LX POST --post301 -F token=${TRIGGER_TOKEN} -F ref=image ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/trigger/pipeline
# apk add curl && curl -LX POST --post301 -F token=${TRIGGER_TOKEN} -F ref=server ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/trigger/pipeline
tags:
- docker
- armv7l
only:
- alpine
armv7l:build-test:
variables:
ARCH: armv7l
stage: build-test
script:
- docker build --build-arg HTTP_PROXY=http://proxy.dege.lan:3128 --file Dockerfile.phptest -t ${CI_REGISTRY_IMAGE}:${VERSIONARCH}-test .
- docker push ${CI_REGISTRY_IMAGE}:${VERSIONARCH}-test
tags:
- docker
- armv7l
only:
- alpine
x86_64:build-manifest:
stage: build-manifest
script:
- docker manifest create ${CI_REGISTRY_IMAGE}:${VERSION} ${CI_REGISTRY_IMAGE}:${VERSION}-armv7l ${CI_REGISTRY_IMAGE}:${VERSION}-x86_64
- docker manifest push --purge ${CI_REGISTRY_IMAGE}:${VERSION}
tags:
- docker
- x86_64
only:
- alpine
x86_64:build-manifest-test:
stage: build-manifest-test
script:
- docker manifest create ${CI_REGISTRY_IMAGE}:${VERSION}-test ${CI_REGISTRY_IMAGE}:${VERSION}-armv7l-test ${CI_REGISTRY_IMAGE}:${VERSION}-x86_64-test
- docker manifest push --purge ${CI_REGISTRY_IMAGE}:${VERSION}-test
2020-08-23 02:54:50 +00:00
tags:
- docker
- x86_64
only:
- alpine