Skip to content

Commit 8b40d12

Browse files
committed
🚧 Work in progress: Improve definition of the docker-image;
1 parent 43b518c commit 8b40d12

File tree

3 files changed

+23
-11
lines changed

3 files changed

+23
-11
lines changed

ci/Dockerfile

+15-4
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,22 @@ COPY --chown=${DEVBOX_USER}:${DEVBOX_USER} devbox.json devbox.json
99
COPY --chown=${DEVBOX_USER}:${DEVBOX_USER} devbox.lock devbox.lock
1010

1111

12-
# Step 6: Copying local flakes directories
13-
COPY ./.devbox/virtenv/mysql/flake ./.devbox/virtenv/mysql/flake
14-
COPY ./nix ./nix
12+
# # 💡 Here maybe the chown is missing!
13+
# # Step 6: Copying local flakes directories
14+
# COPY ./.devbox/virtenv/mysql/flake ./.devbox/virtenv/mysql/flake
15+
# COPY ./nix ./nix
1516

16-
RUN devbox run -- echo "Installed Packages."
17+
# 💡 The issue probably is, that we don't copy the necessary files before.
18+
# I alternatively will try to avoid the copies and read-only-mount those directories
19+
# into the image.
20+
RUN --mount=type=bind,source=./nix,target=/code/nix,readonly \
21+
--mount=type=bind,source=./.devbox,target=/code/.devbox,readonly \
22+
<<-EODI
23+
echo "ls -lah /code: $(ls -lah /code)"
24+
echo "ls -lah /code/.devbox: $(ls -lah /code/.devbox)"
25+
echo "ls -lah /code/.devbox/gen: $(ls -lah /code/.devbox/gen)"
26+
devbox run -- echo "Installed Packages."
27+
EODI
1728

1829
# 🚧 To-do: Check if “ENTRYPOINT” is not the better alternative, see:
1930
# <https://www.bmc.com/blogs/docker-cmd-vs-entrypoint>

ci/Dockerfile.dockerignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
!/flake.nix
99
!/flake.lock
1010

11-
!./.devbox/virtenv/mysql/flake
11+
!./.devbox
1212
!/devbox.json
1313
!/devbox.lock

ci/Makefile

+7-6
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,15 @@ docker-login:
3535
echo 'Already logged in into ${DOCKER_REGISTRY}, skipping login.'
3636
fi
3737

38-
# 🚧 To-do: Come with appropriate Dockerignore!
38+
oci-image-location := ${repository-root}/build/app-autoscaler-release-tools.tar.zst
3939
.PHONY: docker-image
40-
docker-image: ./Makefile Dockerfile ${development-environment-definition}
41-
docker build --file='./Dockerfile' '${repository-root}' \
42-
--tag='${DOCKER_REGISTRY}/${DOCKER_REPOSITORY}:latest'
40+
docker-image: ${oci-image-location}
41+
${oci-image-location}: ./Makefile Dockerfile ${development-environment-definition}
42+
@readonly image_tag='${DOCKER_REGISTRY}/${DOCKER_REPOSITORY}:latest'
43+
docker build --file='./Dockerfile' '${repository-root}' --tag="$${image_tag}"
44+
docker image save "$${image_tag}" | zstd > '${oci-image-location}'
4345

44-
# 🚧 To-do: Include workflow to produce the image and push it from the CI/CD-pipeline, see:
45-
# <https://github.com/cloudfoundry/app-autoscaler-release/pull/2943/files#diff-b4df0a4f0d80f73138c476afbd7aefdac9df339642ddfba323d27c8cbabb92e2>
46+
.PHONY: docker-image-push
4647
docker-image-push: docker-login docker-image
4748
@ARTIFACT='${DOCKER_REGISTRY}/${DOCKER_REPOSITORY}:$*'
4849
echo "Uploading image" "$${ARTIFACT}"

0 commit comments

Comments
 (0)