Skip to content

Commit a0b765e

Browse files
authored
Merge pull request #10 from okteto/jpf-okteto/plat-704
feat: dual rootless/rootful container image (PLAT-704)
2 parents fe0a91b + a11d81d commit a0b765e

File tree

4 files changed

+44
-10
lines changed

4 files changed

+44
-10
lines changed

.circleci/config.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,11 @@ jobs:
1515
- checkout
1616
- run: *okteto-login
1717
- run:
18-
name: Build Image
19-
command: make build
18+
name: Build Rootful Image
19+
command: make build-rootful
20+
- run:
21+
name: Build Rootless Image
22+
command: make build-rootless
2023
release:
2124
docker:
2225
- image: cimg/base:current
@@ -25,8 +28,11 @@ jobs:
2528
- run: *okteto-login
2629
- run: *docker-login
2730
- run:
28-
name: Build and Push Image
29-
command: make push
31+
name: Build and Push Rootful Image
32+
command: make push-rootful
33+
- run:
34+
name: Build and Push Rootless Image
35+
command: make push-rootless
3036

3137
workflows:
3238
version: 2

Dockerfile

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# syntax = docker/dockerfile:experimental
2-
FROM debian:bookworm-slim
2+
FROM debian:bookworm-slim as base
33

44
COPY --from=cuelang/cue:0.9.2 /usr/bin/cue /usr/local/bin/cue
55
COPY --from=mikefarah/yq:4 /usr/bin/yq /usr/local/bin/yq
@@ -19,3 +19,13 @@ RUN apt clean && apt update && \
1919
wait-for-it \
2020
jq \
2121
netcat-traditional
22+
23+
FROM base as rootless
24+
25+
RUN addgroup --gid 1000 runner && \
26+
adduser --disabled-login --home /home/runner --ingroup runner --uid 1000 runner
27+
28+
USER 1000
29+
30+
# keep basic container image build rootful as before
31+
FROM base as rootful

Makefile

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,25 @@
11
CIRCLE_TAG ?= dev
22

3-
build:
4-
okteto build --platform linux/amd64,linux/arm64 -f Dockerfile .
3+
# keep 'build' makefile step rootful for backwards compatibility
4+
build: build-rootful
55

6-
push:
7-
okteto build -t okteto/pipeline-runner:${CIRCLE_TAG} --platform linux/amd64,linux/arm64 -f Dockerfile .
6+
build-rootful:
7+
okteto build --platform linux/amd64,linux/arm64 -f Dockerfile --target rootful .
8+
9+
build-rootless:
10+
okteto build --platform linux/amd64,linux/arm64 -f Dockerfile --target rootless .
11+
12+
# keep 'push' makefile step rootful for backwards compatibility
13+
push: push-rootful
14+
15+
push-rootful:
16+
okteto build -t okteto/pipeline-runner:${CIRCLE_TAG} --platform linux/amd64,linux/arm64 -f Dockerfile --target rootful .
17+
18+
push-rootless:
19+
okteto build -t okteto/pipeline-runner:${CIRCLE_TAG}-rootless --platform linux/amd64,linux/arm64 -f Dockerfile --target rootless .
20+
21+
push-dev-rootful:
22+
okteto build -t okteto.dev/pipeline-runner:dev --platform linux/amd64,linux/arm64 -f Dockerfile --target rootful .
23+
24+
push-dev-rootless:
25+
okteto build -t okteto.dev/pipeline-runner:dev-rootless --platform linux/amd64,linux/arm64 -f Dockerfile --target rootless .

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ installer:
1717
runner: okteto/pipeline-runner:1.0.0
1818
```
1919

20-
replacing `okteto/pipeline-runner:1.0.0` by your own pipeline runner image.
20+
replacing `okteto/pipeline-runner:1.0.0` by your own pipeline runner image.

0 commit comments

Comments
 (0)