diff --git a/frontend/.plano.py b/frontend/.plano.py new file mode 100644 index 0000000..30cec89 --- /dev/null +++ b/frontend/.plano.py @@ -0,0 +1,41 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +from plano import * + +image_tag = "quay.io/skupper/trade-zoo-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} .") + +@command +def run_(): + run(f"podman run --net host {image_tag}") + +@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}") diff --git a/frontend/.planofile b/frontend/.planofile deleted file mode 100644 index 554d57d..0000000 --- a/frontend/.planofile +++ /dev/null @@ -1,18 +0,0 @@ -image_tag = "quay.io/skupper/trade-zoo-frontend" - -@command -def build(app): - with working_dir(".."): - run("plano build") - - run(f"podman build -t {image_tag} .") - -@command -def run_(app): - build(app) - run(f"podman run --net host {image_tag}") - -@command -def push(app): - build(app) - run(f"podman push {image_tag}") diff --git a/frontend/Containerfile b/frontend/Containerfile index 11814e1..2595a54 100644 --- a/frontend/Containerfile +++ b/frontend/Containerfile @@ -1,12 +1,37 @@ -FROM registry.fedoraproject.org/fedora-minimal:36 +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# -RUN microdnf -y install gcc librdkafka-devel python3-devel python3-pip && microdnf clean all +FROM python:alpine AS build -RUN pip install starlette sse_starlette confluent_kafka uvicorn +RUN apk add --no-cache gcc librdkafka-dev musl-dev +RUN pip install --no-cache-dir confluent-kafka starlette sse_starlette uvicorn -COPY python /app/python -COPY static /app/static +FROM python:alpine AS run -WORKDIR /app +RUN apk add --no-cache librdkafka -ENTRYPOINT ["python3", "python/main.py"] +RUN adduser -S fritz -G root +USER fritz + +COPY --from=build /usr/local/lib/python3.12/site-packages /usr/local/lib/python3.12/site-packages +COPY --chown=fritz:root python /home/fritz/python +COPY --chown=fritz:root static /home/fritz/static + +WORKDIR /home/fritz +ENTRYPOINT ["python", "python/main.py"] diff --git a/market-data/.plano.py b/market-data/.plano.py new file mode 100644 index 0000000..62cf76e --- /dev/null +++ b/market-data/.plano.py @@ -0,0 +1,41 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +from plano import * + +image_tag = "quay.io/skupper/trade-zoo-market-data" + +@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} .") + +@command +def run_(): + run(f"podman run --net host {image_tag}") + +@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}") diff --git a/market-data/.planofile b/market-data/.planofile deleted file mode 100644 index 55f9d2e..0000000 --- a/market-data/.planofile +++ /dev/null @@ -1,18 +0,0 @@ -image_tag = "quay.io/skupper/trade-zoo-market-data" - -@command -def build(app): - with working_dir(".."): - run("plano build") - - run(f"podman build -t {image_tag} .") - -@command -def run_(app): - build(app) - run(f"podman run --net host {image_tag}") - -@command -def push(app): - build(app) - run(f"podman push {image_tag}") diff --git a/market-data/Containerfile b/market-data/Containerfile index eb76428..fbf2938 100644 --- a/market-data/Containerfile +++ b/market-data/Containerfile @@ -1,11 +1,36 @@ -FROM registry.fedoraproject.org/fedora-minimal:36 +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# -RUN microdnf -y install gcc librdkafka-devel python3-devel python3-pip && microdnf clean all +FROM python:alpine AS build -RUN pip install starlette sse_starlette confluent_kafka uvicorn +RUN apk add --no-cache gcc librdkafka-dev musl-dev +RUN pip install --no-cache-dir confluent-kafka -COPY python /app/python +FROM python:alpine AS run -WORKDIR /app +RUN apk add --no-cache librdkafka -ENTRYPOINT ["python3", "python/main.py"] +RUN adduser -S fritz -G root +USER fritz + +COPY --from=build /usr/local/lib/python3.12/site-packages /usr/local/lib/python3.12/site-packages +COPY --chown=fritz:root python /home/fritz/python + +WORKDIR /home/fritz +ENTRYPOINT ["python", "python/main.py"] diff --git a/order-processor/.plano.py b/order-processor/.plano.py new file mode 100644 index 0000000..30f273b --- /dev/null +++ b/order-processor/.plano.py @@ -0,0 +1,41 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +from plano import * + +image_tag = "quay.io/skupper/trade-zoo-order-processor" + +@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} .") + +@command +def run_(): + run(f"podman run --net host {image_tag}") + +@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}") diff --git a/order-processor/.planofile b/order-processor/.planofile deleted file mode 100644 index b7328ea..0000000 --- a/order-processor/.planofile +++ /dev/null @@ -1,18 +0,0 @@ -image_tag = "quay.io/skupper/trade-zoo-order-processor" - -@command -def build(app): - with working_dir(".."): - run("plano build") - - run(f"podman build -t {image_tag} .") - -@command -def run_(app): - build(app) - run(f"podman run --net host {image_tag}") - -@command -def push(app): - build(app) - run(f"podman push {image_tag}") diff --git a/order-processor/Containerfile b/order-processor/Containerfile index eb76428..fbf2938 100644 --- a/order-processor/Containerfile +++ b/order-processor/Containerfile @@ -1,11 +1,36 @@ -FROM registry.fedoraproject.org/fedora-minimal:36 +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# -RUN microdnf -y install gcc librdkafka-devel python3-devel python3-pip && microdnf clean all +FROM python:alpine AS build -RUN pip install starlette sse_starlette confluent_kafka uvicorn +RUN apk add --no-cache gcc librdkafka-dev musl-dev +RUN pip install --no-cache-dir confluent-kafka -COPY python /app/python +FROM python:alpine AS run -WORKDIR /app +RUN apk add --no-cache librdkafka -ENTRYPOINT ["python3", "python/main.py"] +RUN adduser -S fritz -G root +USER fritz + +COPY --from=build /usr/local/lib/python3.12/site-packages /usr/local/lib/python3.12/site-packages +COPY --chown=fritz:root python /home/fritz/python + +WORKDIR /home/fritz +ENTRYPOINT ["python", "python/main.py"]