You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note the `uid-range` and `supplemental-groups`. In this case, the project `coder`
174
+
has been allocated 10,000 UIDs starting at 1000680000, and 10,000 GIDs starting
175
+
at 1000680000. In this example, we will pick UID and GID 1000680000.
176
176
177
177
1. Create a `BuildConfig` referencing the source image you want to customize.
178
-
This will automatically kick off a `Build` that will remain pending until step 3.
179
-
180
-
> For more information, please consult the [OpenShift Documentation](https://docs.openshift.com/container-platform/4.12/cicd/builds/understanding-buildconfigs.html).
181
-
182
-
```console
183
-
oc create -f - <<EOF
184
-
kind: BuildConfig
185
-
apiVersion: build.openshift.io/v1
186
-
metadata:
187
-
name: enterprise-base
188
-
namespace: coder
189
-
spec:
190
-
output:
191
-
to:
192
-
kind: ImageStreamTag
193
-
name: 'enterprise-base:latest'
194
-
strategy:
195
-
type: Docker
196
-
dockerStrategy:
197
-
imageOptimizationPolicy: SkipLayers
198
-
source:
199
-
type: Dockerfile
200
-
dockerfile: |
201
-
# Specify the source image.
202
-
FROM docker.io/codercom/enterprise-base:ubuntu
203
-
204
-
# Switch to root
205
-
USER root
206
-
207
-
# As root:
208
-
# 1) Remove the original coder user with UID 1000
209
-
# 2) Add a coder group with an allowed UID
210
-
# 3) Add a coder user as a member of the above group
211
-
# 4) Fix ownership on the user's home directory
212
-
RUN userdel coder && \
213
-
groupadd coder -g 1000680000 && \
214
-
useradd -l -u 1000680000 coder -g 1000680000 && \
215
-
chown -R coder:coder /home/coder
216
-
217
-
# Go back to the user 'coder'
218
-
USER coder
219
-
triggers:
220
-
- type: ConfigChange
221
-
runPolicy: Serial
222
-
EOF
223
-
```
224
-
178
+
This will automatically kick off a `Build` that will remain pending until step 3.
179
+
180
+
> For more information, please consult the [OpenShift Documentation](https://docs.openshift.com/container-platform/4.12/cicd/builds/understanding-buildconfigs.html).
181
+
182
+
```console
183
+
oc create -f - <<EOF
184
+
kind: BuildConfig
185
+
apiVersion: build.openshift.io/v1
186
+
metadata:
187
+
name: enterprise-base
188
+
namespace: coder
189
+
spec:
190
+
output:
191
+
to:
192
+
kind: ImageStreamTag
193
+
name: 'enterprise-base:latest'
194
+
strategy:
195
+
type: Docker
196
+
dockerStrategy:
197
+
imageOptimizationPolicy: SkipLayers
198
+
source:
199
+
type: Dockerfile
200
+
dockerfile: |
201
+
# Specify the source image.
202
+
FROM docker.io/codercom/enterprise-base:ubuntu
203
+
204
+
# Switch to root
205
+
USER root
206
+
207
+
# As root:
208
+
# 1) Remove the original coder user with UID 1000
209
+
# 2) Add a coder group with an allowed UID
210
+
# 3) Add a coder user as a member of the above group
211
+
# 4) Fix ownership on the user's home directory
212
+
RUN userdel coder && \
213
+
groupadd coder -g 1000680000 && \
214
+
useradd -l -u 1000680000 coder -g 1000680000 && \
215
+
chown -R coder:coder /home/coder
216
+
217
+
# Go back to the user 'coder'
218
+
USER coder
219
+
triggers:
220
+
- type: ConfigChange
221
+
runPolicy: Serial
222
+
EOF
223
+
```
225
224
226
225
1. Create an `ImageStream` as a target for the previous step:
227
226
228
-
```console
229
-
oc create imagestream enterprise-base
230
-
```
227
+
```console
228
+
oc create imagestream enterprise-base
229
+
```
231
230
232
-
The `Build` created in the previous step should now begin.
233
-
Once completed, you should see output similar to the following:
231
+
The `Build` created in the previous step should now begin.
232
+
Once completed, you should see output similar to the following:
234
233
235
-
```console
236
-
oc get imagestreamtag
237
-
NAME IMAGE REFERENCE UPDATED
238
-
enterprise-base:latest image-registry.openshift-image-registry.svc:5000/coder/enterprise-base@sha256:1dbbe4ee11be9218e1e4741264135a4f57501fe592d94d20db6bfe11692accd1 55 minutes ago
239
-
```
234
+
```console
235
+
oc get imagestreamtag
236
+
NAME IMAGE REFERENCE UPDATED
237
+
enterprise-base:latest image-registry.openshift-image-registry.svc:5000/coder/enterprise-base@sha256:1dbbe4ee11be9218e1e4741264135a4f57501fe592d94d20db6bfe11692accd1 55 minutes ago
238
+
```
240
239
241
240
### 8. Create an OpenShift-compatible template
242
241
@@ -251,7 +250,7 @@ Edit `main.tf` and update the following fields of the Kubernetes pod resource:
251
250
252
251
- `spec.security_context`: remove this field.
253
252
- `spec.container.image`: update this field to the newly built image hosted
254
-
on the OpenShift image registry from the previous step.
253
+
on the OpenShift image registry from the previous step.
255
254
- `spec.container.security_context`: remove this field.
0 commit comments