| ... | @@ -32,3 +32,20 @@ You can give as much information as possible to the team for creation: |
... | @@ -32,3 +32,20 @@ You can give as much information as possible to the team for creation: |
|
|
2. Add the new informations to your Variables (`Settings/CI/CD/Variables`)
|
|
2. Add the new informations to your Variables (`Settings/CI/CD/Variables`)
|
|
|
* Add the username (by default `gitlab+deploy-token-xx`) and name it `DEPLOY_USER`
|
|
* Add the username (by default `gitlab+deploy-token-xx`) and name it `DEPLOY_USER`
|
|
|
* Add the token and name it `DEPLOY_TOKEN`
|
|
* Add the token and name it `DEPLOY_TOKEN`
|
|
|
|
|
|
|
|
### Build your image
|
|
|
|
|
|
|
|
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:
|
|
|
|
```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. |
|
|
|
\ No newline at end of file |