8888 spec :
8989 restartPolicy : Never
9090 initContainers :
91- - name : init-ocir-login
92- image : docker.io/alpine:latest
93- command :
94- - sh
95- - -c
96- - |
97- apk add --no-cache jq oci-cli docker && \
98- export TOKEN=$(oci raw-request --http-method GET --target-uri https://${repository_host}/20180419/docker/token | jq -r '.data.token') && \
99- echo "$TOKEN" | docker login -u 'BEARER_TOKEN' --password-stdin ${repository_host} && \
100- chown 1000:1000 /root/.docker/config.json
101- env :
102- - name : OCI_CLI_AUTH
103- value : instance_principal
104- volumeMounts :
105- - name : docker-auth
106- mountPath : /root/.docker
10791 - name : prepare-source-code
10892 image : docker.io/alpine:latest
10993 command :
@@ -118,27 +102,41 @@ spec:
118102 volumeMounts :
119103 - name : workspace
120104 mountPath : /workspace
105+ - name : init-ocir-login
106+ image : ghcr.io/oracle/oci-cli:latest
107+ command :
108+ - sh
109+ - -c
110+ - |
111+ export TOKEN=$(oci raw-request --http-method GET --target-uri https://${repository_host}/20180419/docker/token | jq -r '.data.token')
112+ mkdir -p /docker-config
113+ echo "{\"auths\":{\"${repository_host}\":{\"auth\":\"$(echo -n "BEARER_TOKEN:$TOKEN" | base64 -w0)\"}}}" > /docker-config/config.json
114+ chown 1000:1000 /docker-config/config.json
115+ cat /docker-config/config.json
116+ env :
117+ - name : OCI_CLI_AUTH
118+ value : instance_principal
119+ volumeMounts :
120+ - name : docker-auth
121+ mountPath : /docker-config
121122 containers :
122- - name : buildkit-server
123+ - name : buildkit-client
123124 image : docker.io/moby/buildkit:master-rootless
124125 env :
125126 - name : BUILDKITD_FLAGS
126127 value : --oci-worker-no-process-sandbox --oci-worker-gc=false
127128 command :
128- - buildctl-daemonless.sh
129+ - sh
130+ - -c
129131 args :
130- - build
131- - --no-cache
132- - --progress
133- - plain
134- - --frontend
135- - dockerfile.v0
136- - --local
137- - context=/workspace
138- - --local
139- - dockerfile=/workspace/server
140- - --output
141- - type=image,name=${repository_server}:latest,push=true
132+ - |
133+ buildctl-daemonless.sh build \
134+ --no-cache \
135+ --progress plain \
136+ --frontend dockerfile.v0 \
137+ --local context=/workspace \
138+ --local dockerfile=/workspace/client \
139+ --output type=image,name=${repository_client}:latest,push=true
142140 securityContext :
143141 seccompProfile :
144142 type : Unconfined
@@ -150,31 +148,28 @@ spec:
150148 - name : workspace
151149 mountPath : /workspace
152150 readOnly : true
153- - name : buildkitd
154- mountPath : /home/user/.local/share/buildkit/server
151+ - name : buildkitd-client
152+ mountPath : /home/user/.local/share/buildkit
155153 - name : docker-auth
156154 mountPath : /home/user/.docker
157155 readOnly : true
158- - name : buildkit-client
156+ - name : buildkit-server
159157 image : docker.io/moby/buildkit:master-rootless
160158 env :
161159 - name : BUILDKITD_FLAGS
162160 value : --oci-worker-no-process-sandbox --oci-worker-gc=false
163161 command :
164- - buildctl-daemonless.sh
162+ - sh
163+ - -c
165164 args :
166- - build
167- - --no-cache
168- - --progress
169- - plain
170- - --frontend
171- - dockerfile.v0
172- - --local
173- - context=/workspace
174- - --local
175- - dockerfile=/workspace/client
176- - --output
177- - type=image,name=${repository_client}:latest,push=true
165+ - |
166+ buildctl-daemonless.sh build \
167+ --no-cache \
168+ --progress plain \
169+ --frontend dockerfile.v0 \
170+ --local context=/workspace \
171+ --local dockerfile=/workspace/server \
172+ --output type=image,name=${repository_server}:latest,push=true
178173 securityContext :
179174 seccompProfile :
180175 type : Unconfined
@@ -186,15 +181,17 @@ spec:
186181 - name : workspace
187182 mountPath : /workspace
188183 readOnly : true
189- - name : buildkitd
190- mountPath : /home/user/.local/share/buildkit/client
184+ - name : buildkitd-server
185+ mountPath : /home/user/.local/share/buildkit
191186 - name : docker-auth
192187 mountPath : /home/user/.docker
193188 readOnly : true
194189 volumes :
195190 - name : workspace
196191 emptyDir : {}
197- - name : buildkitd
192+ - name : buildkitd-client
193+ emptyDir : {}
194+ - name : buildkitd-server
198195 emptyDir : {}
199196 - name : docker-auth
200197 emptyDir : {}
0 commit comments