https://github.com/jonashackt/gitlab-ci-docker-socket-binding-example
Example project using GitLab CI docker executor with binding the Host's Docker engine into it instead of using Docker-in-Docker (as with https://github.com/jonashackt/gitlab-ci-dind-example)
https://github.com/jonashackt/gitlab-ci-docker-socket-binding-example
Last synced: 5 months ago
JSON representation
Example project using GitLab CI docker executor with binding the Host's Docker engine into it instead of using Docker-in-Docker (as with https://github.com/jonashackt/gitlab-ci-dind-example)
- Host: GitHub
- URL: https://github.com/jonashackt/gitlab-ci-docker-socket-binding-example
- Owner: jonashackt
- License: mit
- Created: 2019-08-26T12:25:10.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2024-08-26T17:18:03.000Z (almost 2 years ago)
- Last Synced: 2025-04-01T15:22:38.427Z (about 1 year ago)
- Language: Java
- Size: 26.4 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Example app for building inside GitLab CI - using Docker socket binding
=============================
This GitLab CI example needs a corresponding GitLab runner configuration - see https://github.com/jonashackt/gitlab-ci-stack#configure-a-docker-socket-binding-enabled-gitlab-runner-with-the-docker-executor
See [.gitlab-ci.yml](.gitlab-ci.yml):
```
# One of the new trends in Continuous Integration/Deployment is to:
# (see https://docs.gitlab.com/ee/ci/docker/using_docker_build.html)
#
# 1. Create an application image
# 2. Run tests against the created image
# 3. Push image to a remote registry
# 4. Deploy to a server from the pushed image
stages:
- build
- test
- push
- deploy
# see usage of Namespaces at https://docs.gitlab.com/ee/user/group/#namespaces
variables:
REGISTRY_GROUP_PROJECT: $CI_REGISTRY/root/gitlab-ci-shell-example
# see how to login at https://docs.gitlab.com/ee/ci/docker/using_docker_build.html#using-the-gitlab-container-registry
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_JOB_TOKEN $CI_REGISTRY
build-image:
stage: build
# the tag 'shell' advices only GitLab runners using this tag to pick up that job
tags:
- shell
script:
- docker build . --tag $REGISTRY_GROUP_PROJECT/gitlab-ci-shell-example:latest
test-image:
stage: test
tags:
- shell
script:
- echo Insert fancy API test here!
push-image:
stage: push
tags:
- shell
script:
- docker push $REGISTRY_GROUP_PROJECT/gitlab-ci-shell-example:latest
deploy-2-dev:
stage: deploy
tags:
- shell
script:
- echo You should use Ansible here!
environment:
name: dev
url: https://dev.jonashackt.io
```
### Swagger REST-API-Documentation
Start the app and go to [http://localhost:8080/v2/api-docs](http://localhost:8080/v2/api-docs) to see all endpoints as JSON.
UI-Documentation you will find under [http://localhost:8080/swagger-ui.html](http://localhost:8080/swagger-ui.html).