Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions .github/workflows/build-multiarch-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,4 @@ jobs:

- name: Build and Push Multi-Arch Image
run: |
cd backend && \
docker buildx build \
--platform linux/amd64,linux/arm64,linux/s390x \
-t quay.io/skupper/hello-world-backend \
--push -f Containerfile .
./plano --file backend/.plano.py build,push
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using plano available in parent directory and providing appropriate .plano.py file to use for targets.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@KaushikOP , this looks ok, but have you successfully run an image generated with that command? I have the impression that, being run from the repo root directory, it's pulling the wrong python directory. When I ran using an image built with these instructions, this is what I got:

$ podman run quay.io/skupper/hello-world-backend -p 8080:8080
python: can't open file '/home/fritz/python/main.py': [Errno 2] No such file or directory

Inspecting the image, the contents of the python directory correspond to the one at the repo root (plano, skewer), and not the one from backend/python (main.py, thingid.py):

$ podman run -p 8080:8080 -ti --entrypoint sh quay.io/skupper/hello-world-backend                                                                                          
~ $ ls
python
~ $ ls -l python
total 8
lrwxrwxrwx    1 fritz    root            31 Aug 22  2024 plano -> ../external/skewer/python/plano
lrwxrwxrwx    1 fritz    root            32 Aug 22  2024 skewer -> ../external/skewer/python/skewer

Or perhaps I'm doing something wrong? If not, the options would be to:

  • Keep the cd command, run plano from the subdir, or
  • Update backend/.plano.py to use backend instead of . as the build context directory

I'd rather keep the cd, as to not change the current operation on plano

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Earlier Changes in my custom image had the similar issue; I changed the context for image builds and now I can see image running.

`$ podman run -p 8080:8080 -ti --entrypoint sh quay.io/ktalathi/skupper/hello-world-frontend:latest
~ $ ls
python static
~ $ ls -l python/
total 16
-rw-r--r-- 1 fritz root 8682 Nov 18 12:05 animalid.py
-rw-r--r-- 1 fritz root 3536 Nov 18 12:05 main.py
~ $ ls -l static/
total 12
drwxr-xr-x 2 fritz root 161 Nov 18 12:05 gesso
-rw-r--r-- 1 fritz root 268 Nov 18 12:05 index.html
-rw-r--r-- 1 fritz root 124 Nov 18 12:05 main.css
-rw-r--r-- 1 fritz root 2434 Nov 18 12:05 main.js
~ $
~ $ exit
$

$ podman run quay.io/ktalathi/skupper/hello-world-backend:latest
INFO: Started server process [1]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://0.0.0.0:8080 (Press CTRL+C to quit)

^CINFO: Shutting down
INFO: Waiting for application shutdown.
INFO: Application shutdown complete.
INFO: Finished server process [1]
$
`

Keep the cd command, run plano from the subdir, or

This causes issue as plano is not getting initialized properly in subdir. It only works properly in root dir.
That is why going with other option and setting context in specific .plano.py files in sub directories.

6 changes: 1 addition & 5 deletions .github/workflows/build-multiarch-frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,4 @@ jobs:

- name: Build and Push Multi-Arch Image
run: |
cd frontend && \
docker buildx build \
--platform linux/amd64,linux/arm64,linux/s390x \
-t quay.io/skupper/hello-world-frontend \
--push -f Containerfile .
./plano --file frontend/.plano.py update-gesso,build,push
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using plano available in parent directory and providing appropriate .plano.py file to use for targets.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as mentioned above for backend (running from repo root dir):

$ podman run -p 8081:8080 -ti quay.io/skupper/hello-world-frontend 
python: can't open file '/home/fritz/python/main.py': [Errno 2] No such file or directory

I tested running from the frontend dir with the following change, and the image ran fine:

-    run(f"podman build {no_cache_arg} --format docker --platform linux/amd64,linux/arm64,linux/s390x,linux/ppc64le --file frontend/Containerfile --manifest {image_tag} .")
+    run(f"podman build {no_cache_arg} --format docker --platform linux/amd64,linux/arm64,linux/s390x,linux/ppc64le --file Containerfile --manifest {image_tag} .")

I had to set PYTHONPATH to <repo_root>/python before running it, though.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Earlier Changes in my custom image had the similar issue; I changed the context for image builds and now I can see image running.

`
$ podman run -p 8080:8080 -ti --entrypoint sh quay.io/ktalathi/skupper/hello-world-frontend:latest
~ $ ls
python static
~ $ ls -l python/
total 16
-rw-r--r-- 1 fritz root 8682 Nov 18 12:05 animalid.py
-rw-r--r-- 1 fritz root 3536 Nov 18 12:05 main.py
~ $ ls -l static/
total 12
drwxr-xr-x 2 fritz root 161 Nov 18 12:05 gesso
-rw-r--r-- 1 fritz root 268 Nov 18 12:05 index.html
-rw-r--r-- 1 fritz root 124 Nov 18 12:05 main.css
-rw-r--r-- 1 fritz root 2434 Nov 18 12:05 main.js
~ $
~ $ exit
$

$ podman run quay.io/ktalathi/skupper/hello-world-frontend:latest
INFO: Started server process [1]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://0.0.0.0:8080 (Press CTRL+C to quit)

^CINFO: Shutting down
INFO: Waiting for application shutdown.
INFO: Application shutdown complete.
INFO: Finished server process [1]
$
`

2 changes: 1 addition & 1 deletion .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
strategy:
fail-fast: false
matrix:
skupper-version: [latest, main]
skupper-version: [v1-dev-release, main]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion backend/.plano.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def build(no_cache=False):
# podman build with --manifest creates or adds to an existing manifest. We want brand new
run(f"podman manifest rm {image_tag}", check=False)
run(f"podman rmi {image_tag}", check=False)
run(f"podman build {no_cache_arg} --format docker --platform linux/amd64,linux/arm64,linux/s390x --manifest {image_tag} .")
run(f"podman build {no_cache_arg} --format docker --platform linux/amd64,linux/arm64,linux/s390x,linux/ppc64le --file backend/Containerfile --manifest {image_tag} ./backend")
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep the cd command, run plano from the subdir, or
Update backend/.plano.py to use backend instead of . as the build context directory

Updated to use appropriate context image build.
The plano tool is directly available only at root dir. Plus, the dependant python packages in root python dir.



@command
Expand Down
2 changes: 1 addition & 1 deletion backend/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ FROM --platform=$TARGETPLATFORM mirror.gcr.io/library/python:alpine AS run
RUN adduser -S fritz -G root
USER fritz

COPY --from=build /usr/local/lib/python3.13/site-packages /usr/local/lib/python3.13/site-packages
COPY --from=build /usr/local/lib/python3.14/site-packages /usr/local/lib/python3.14/site-packages
COPY --chown=fritz:root python /home/fritz/python

EXPOSE 8080
Expand Down
2 changes: 1 addition & 1 deletion frontend/.plano.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def build(no_cache=False):
# podman build with --manifest creates or adds to an existing manifest. We want brand new
run(f"podman manifest rm {image_tag}", check=False)
run(f"podman rmi {image_tag}", check=False)
run(f"podman build {no_cache_arg} --format docker --platform linux/amd64,linux/arm64,linux/s390x --manifest {image_tag} .")
run(f"podman build {no_cache_arg} --format docker --platform linux/amd64,linux/arm64,linux/s390x,linux/ppc64le --file frontend/Containerfile --manifest {image_tag} ./frontend")
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep the cd command, run plano from the subdir, or
Update backend/.plano.py to use backend instead of . as the build context directory

Updated to use appropriate context image build.
The plano tool is directly available only at root dir. Plus, the dependant python packages in root python dir.



@command
Expand Down
2 changes: 1 addition & 1 deletion frontend/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ FROM --platform=$TARGETPLATFORM mirror.gcr.io/library/python:alpine AS run
RUN adduser -S fritz -G root
USER fritz

COPY --from=build /usr/local/lib/python3.13/site-packages /usr/local/lib/python3.13/site-packages
COPY --from=build /usr/local/lib/python3.14/site-packages /usr/local/lib/python3.14/site-packages
COPY --chown=fritz:root python /home/fritz/python
COPY --chown=fritz:root static /home/fritz/static

Expand Down