Skip to content

Commit

Permalink
Update the app containers
Browse files Browse the repository at this point in the history
  • Loading branch information
ssorj committed Feb 23, 2024
1 parent ea3fad5 commit f436aff
Show file tree
Hide file tree
Showing 9 changed files with 217 additions and 73 deletions.
41 changes: 41 additions & 0 deletions frontend/.plano.py
Original file line number Diff line number Diff line change
@@ -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}")
18 changes: 0 additions & 18 deletions frontend/.planofile

This file was deleted.

39 changes: 32 additions & 7 deletions frontend/Containerfile
Original file line number Diff line number Diff line change
@@ -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"]
41 changes: 41 additions & 0 deletions market-data/.plano.py
Original file line number Diff line number Diff line change
@@ -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}")
18 changes: 0 additions & 18 deletions market-data/.planofile

This file was deleted.

37 changes: 31 additions & 6 deletions market-data/Containerfile
Original file line number Diff line number Diff line change
@@ -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"]
41 changes: 41 additions & 0 deletions order-processor/.plano.py
Original file line number Diff line number Diff line change
@@ -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}")
18 changes: 0 additions & 18 deletions order-processor/.planofile

This file was deleted.

37 changes: 31 additions & 6 deletions order-processor/Containerfile
Original file line number Diff line number Diff line change
@@ -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"]

0 comments on commit f436aff

Please sign in to comment.