Skip to content

Commit ae1f32a

Browse files
committed
adjusted secrets-vol sample
1 parent 5b9b882 commit ae1f32a

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

secrets-vol/Dockerfile

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
FROM icr.io/codeengine/golang:alpine
2-
COPY secret.go /
3-
RUN go build -o /secret /secret.go
1+
FROM quay.io/projectquay/golang:1.22 AS build-env
2+
WORKDIR /go/src/app
3+
COPY . .
4+
5+
RUN CGO_ENABLED=0 go build -o /go/bin/app secret.go
46

57
# Copy the exe into a smaller base image
6-
FROM icr.io/codeengine/alpine
7-
COPY --from=0 /secret /secret
8-
CMD /secret
8+
FROM gcr.io/distroless/static-debian12
9+
COPY --from=build-env /go/bin/app /
10+
CMD ["/app"]

secrets-vol/run

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ ibmcloud ce secret create --name sec-secret-vol \
3232
--from-file MY_FILE=file
3333

3434
# Create the app
35-
ibmcloud ce app create -n sec-app-vol --image ${REGISTRY}/ce-secret-vol \
36-
--mount-secret /mysecrets=sec-secret-vol
35+
ibmcloud ce app create -n sec-app-vol --image ${REGISTRY}/ce-secret-vol --mount-secret /mysecrets=sec-secret-vol --cpu 0.125 --memory 0.5G
3736

3837
# Get the URL of the app for later use
3938
URL=$(ibmcloud ce app get -n sec-app-vol -o url)
@@ -47,14 +46,15 @@ echo Instance name: $name
4746

4847
# Now check the logs to see if the env vars were set
4948
ibmcloud ce app logs --instance $name | tee out
49+
[[ "${PIPESTATUS[0]}" == "0" ]]
5050
grep MY_ out
51-
if ! [[ $(grep MY_ out | wc -l) == "4" ]]; then
51+
if (( $(grep MY_ out | wc -l) != 4 )); then
5252
echo "Unexpected output"
5353
exit 1
5454
fi
5555

5656
# Check to see if the context of "file" are assign to the "file" env var.
57-
if ! [[ $(grep '^file: In Congress' out | wc -l) == "1" ]]; then
57+
if (( $(grep '^file: In Congress' out | wc -l) != 1 )); then
5858
echo "Unexpected output"
5959
exit 1
6060
fi

0 commit comments

Comments
 (0)