Update Kubernetes setup authored by Kenzo-Hugo Hillion's avatar Kenzo-Hugo Hillion
......@@ -37,15 +37,33 @@ You can give as much information as possible to the team for creation:
First you need to build your image during the CI in gitlab. For this, I recommand to write a script that do this process and call it in the `.gitlab-ci.yml`:
#### Build script:
* **Build script**:
```bash
#!/bin/sh
echo "$CI_REGISTRY_PASSWORD" | docker login -u "$CI_REGISTRY_USER" --password-stdin $CI_REGISTRY
# Build backend
docker build -t "$CI_REGISTRY_IMAGE/backend:${CI_COMMIT_REF_NAME}" backend/
docker tag "$CI_REGISTRY_IMAGE/backend:${CI_COMMIT_REF_NAME}" "$CI_REGISTRY_IMAGE/backend:latest"
docker push "$CI_REGISTRY_IMAGE/backend:${CI_COMMIT_REF_NAME}"
```
> You do not have to set `CI_REGISTRY_PASSWORD` and `$CI_REGISTRY_USER` variables in gitlab.
* **`.gitlab-ci.yml`**:
Add these lines or adapt to your existing `.gitlab-ci.yml`.
```yaml
services:
- docker:18-dind
stages:
- build
build-backend:
image: docker:latest
stage: build
script:
- sh path/to/your/script.sh
tags:
- k8s
```
\ No newline at end of file