Skip to content

Commit

Permalink
Create GitLab.com CI pipeline
Browse files Browse the repository at this point in the history
This pipeline provides us with the packed docker images of the
registry.
  • Loading branch information
horazont committed Jun 14, 2020
1 parent 80fa1ec commit 4e7a3ff
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 15 deletions.
50 changes: 50 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
stages:
- build
- pack

"build@main":
image: registry.gitlab.com/xsf/docker-images/registry-buildspace/image:0.1.0
stage: build
script:
- make
rules:
- if: '$CI_COMMIT_REF_NAME =~ /^main$/'
when: always
- when: never
artifacts:
paths:
- registrar/
expire_in: '1 day'

"pack@main":
image: docker:19.03.11
stage: pack
services:
- docker:19.03.11-dind
script:
- 'export IMAGE_REF="${CI_REGISTRY_IMAGE}/packed:main-$(date -Idate)-${CI_COMMIT_SHORT_SHA}"'
- 'export LATEST_REF="${CI_REGISTRY_IMAGE}/packed:main-latest"'
- 'docker build -t "$IMAGE_REF" -f pack-only.Dockerfile .'
- 'docker image tag "$IMAGE_REF" "$LATEST_REF"'
- 'docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY'
- 'docker push "$IMAGE_REF"'
- 'docker push "$LATEST_REF"'
rules:
- if: '$CI_COMMIT_REF_NAME =~ /^main$/'
when: on_success
- when: never

"build@mr":
image: registry.gitlab.com/xsf/docker-images/registry-buildspace/image:0.1.0
stage: build
script:
- make
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
when: always
- when: never
artifacts:
expose_as: "Content"
paths:
- registrar/
expire_in: '1 day'
15 changes: 0 additions & 15 deletions Dockerfile

This file was deleted.

5 changes: 5 additions & 0 deletions pack-only.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM nginx:1-alpine
COPY registrar/ /usr/share/nginx/html/registar/
RUN sed -ri '/root\s+\/usr\/share\/nginx\/html/s/^(.+)$/\1\nautoindex on;/' /etc/nginx/conf.d/default.conf

EXPOSE 80

0 comments on commit 4e7a3ff

Please sign in to comment.