Skip to content

Commit

Permalink
Changed plano files for multi-arch builds (#15)
Browse files Browse the repository at this point in the history
* Changed plano files for multi-arch builds

* remove pre-existing manifest or image, before building new manifest

* Point back to main repo
  • Loading branch information
hash-d authored Oct 16, 2024
1 parent 3abe253 commit dc08d64
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 8 deletions.
11 changes: 9 additions & 2 deletions backend/.plano.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,28 @@

image_tag = "quay.io/skupper/hello-world-backend"


@command
def build(no_cache=False):
no_cache_arg = "--no-cache" if no_cache else ""

run(f"podman build {no_cache_arg} --format docker -t {image_tag} .")
# 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 --manifest {image_tag} .")


@command
def run_():
run(f"podman run --net host {image_tag} --host localhost --port 8081")


@command
def debug():
run(f"podman run -it --net host --entrypoint /bin/sh {image_tag}")


@command
def push():
run("podman login quay.io")
run(f"podman push {image_tag}")
run(f"podman manifest push {image_tag}")
6 changes: 4 additions & 2 deletions backend/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@
# under the License.
#

FROM python:alpine AS build
ARG TARGETPLATFORM

FROM --platform=$TARGETPLATFORM python:alpine AS build

RUN pip install --no-cache-dir starlette uvicorn

FROM python:alpine AS run
FROM --platform=$TARGETPLATFORM python:alpine AS run

RUN adduser -S fritz -G root
USER fritz
Expand Down
13 changes: 11 additions & 2 deletions frontend/.plano.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,22 @@

image_tag = "quay.io/skupper/hello-world-frontend"


@command
def build(no_cache=False):
no_cache_arg = "--no-cache" if no_cache else ""

run(f"podman build {no_cache_arg} --format docker -t {image_tag} .")
# 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 --manifest {image_tag} .")


@command
def run_():
run(f"podman run --net host {image_tag} --host localhost --port 8080 --backend http://localhost:8081")


@command
def test():
# The backend must be running on port 8081
Expand All @@ -50,14 +56,17 @@ def test():
print(http_post_json("http://localhost:8080/api/hello", {"name": "Obtuse Ocelot", "text": "Bon jour"}))
print()


@command
def debug():
run(f"podman run -it --net host --entrypoint /bin/sh {image_tag}")


@command
def push():
run("podman login quay.io")
run(f"podman push {image_tag}")
run(f"podman manifest push {image_tag}")


@command
def update_gesso():
Expand Down
6 changes: 4 additions & 2 deletions frontend/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@
# under the License.
#

FROM python:alpine AS build
ARG TARGETPLATFORM

FROM --platform=$TARGETPLATFORM python:alpine AS build

RUN pip install --no-cache-dir httpx starlette sse_starlette uvicorn

FROM python:alpine AS run
FROM --platform=$TARGETPLATFORM python:alpine AS run

RUN adduser -S fritz -G root
USER fritz
Expand Down

0 comments on commit dc08d64

Please sign in to comment.