Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit 701e40c

Browse files
authored
fix: update gitlab guide (#600)
1 parent eb8bddb commit 701e40c

File tree

1 file changed

+38
-24
lines changed

1 file changed

+38
-24
lines changed

src/pages/guides/deploying/gitlab-ci.mdx

Lines changed: 38 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ Here is example content you can copy into your workflow file. In the next sectio
2121

2222
```yaml
2323
deploy:
24-
image: docker:24.0.5
24+
image: docker:27
2525
services:
26-
- docker:24.0.5-dind
26+
- docker:27-dind
2727
rules:
2828
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
2929
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
@@ -32,14 +32,19 @@ deploy:
3232
PULUMI_ACCESS_TOKEN: $PULUMI_ACCESS_TOKEN
3333
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
3434
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
35-
HOST_DOCKER_INTERNAL_IFACE: 'eth0'
3635
before_script:
37-
- apk update
38-
- apk add --no-cache curl bash
39-
- curl -L https://nitric.io/install?version=latest | bash
40-
- export PATH=$PATH:$HOME/.nitric/bin
36+
- apk update && apk add --no-cache curl bash
37+
38+
# retrieve the IP address of the docker host, required for docker in docker
39+
- export NITRIC_DOCKER_HOST=$(ip -4 addr show eth0 | grep -o 'inet [0-9\.]*' | awk '{print $2}')
40+
41+
# Install Pulumi
4142
- curl -fsSL https://get.pulumi.com/ | bash
4243
- export PATH=$PATH:$HOME/.pulumi/bin
44+
45+
# Install Nitric
46+
- curl -L https://nitric.io/install?version=latest | bash
47+
- export PATH=$PATH:$HOME/.nitric/bin
4348
script:
4449
- nitric up --ci
4550
```
@@ -49,10 +54,9 @@ deploy:
4954
Edit the config file and start by defining a new job which uses a docker image as the base, and docker-in-docker (dind) as the underlying service.
5055
5156
```yaml
52-
deploy:
53-
image: docker:24.0.5
54-
services:
55-
- docker:24.0.5-dind
57+
image: docker:27
58+
services:
59+
- docker:27-dind
5660
```
5761
5862
### Setup the workflow rules
@@ -91,19 +95,12 @@ Configure the environment variables required by Nitric and Nitric's dependency P
9195
- AWS_SECRET_ACCESS_KEY
9296
- You can obtain a key, including its ID and value, from the amazon console.
9397

94-
#### Nitric
95-
96-
- HOST_DOCKER_INTERNAL_IFACE
97-
98-
- The network interface that the Nitric CLI will temporarily run the containers on. Without this, the containers can't communicate with the Nitric server whilst gathering the resource definitions.
99-
10098
```yaml
10199
variables:
102100
PULUMI_CONFIG_PASSPHRASE: $PULUMI_CONFIG_PASSPHRASE
103101
PULUMI_ACCESS_TOKEN: $PULUMI_ACCESS_TOKEN
104102
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
105103
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
106-
HOST_DOCKER_INTERNAL_IFACE: 'eth0'
107104
```
108105

109106
### Adding base dependencies
@@ -112,8 +109,19 @@ Within the before script, all the dependencies are added. Start by adding `curl`
112109

113110
```yaml
114111
before_script:
115-
- apk update
116-
- apk add --no-cache curl bash
112+
- apk update && apk add --no-cache curl bash
113+
```
114+
115+
### Set the Docker host IP
116+
117+
The `NITRIC_DOCKER_HOST` environment variable is used to store the IP address of the docker internal host. This is required for docker in docker. Here we are getting the first IP address of the `eth0` interface.
118+
119+
```yaml
120+
before_script:
121+
- apk update && apk add --no-cache curl bash
122+
123+
# Retrieve the IP address of the docker host, required for docker in docker
124+
- export NITRIC_DOCKER_HOST=$(ip -4 addr show eth0 | grep -o 'inet [0-9\.]*' | awk '{print $2}')
117125
```
118126

119127
### Install Nitric and dependencies
@@ -122,12 +130,18 @@ These steps install the Nitric CLI and Pulumi, allowing the use of commands such
122130

123131
```yaml
124132
before_script:
125-
- apk update
126-
- apk add --no-cache curl bash
127-
- curl -L https://nitric.io/install?version=latest | bash
128-
- export PATH=$PATH:$HOME/.nitric/bin
133+
- apk update && apk add --no-cache curl bash
134+
135+
# Retrieve the IP address of the docker host, required for docker in docker
136+
- export NITRIC_DOCKER_HOST=$(ip -4 addr show eth0 | grep -o 'inet [0-9\.]*' | awk '{print $2}')
137+
138+
# Install Pulumi
129139
- curl -fsSL https://get.pulumi.com/ | bash
130140
- export PATH=$PATH:$HOME/.pulumi/bin
141+
142+
# Install Nitric
143+
- curl -L https://nitric.io/install?version=latest | bash
144+
- export PATH=$PATH:$HOME/.nitric/bin
131145
```
132146

133147
### Deploy the stack

0 commit comments

Comments
 (0)