Skip to content

Commit d505fb4

Browse files
authored
added a dockerfile (#246)
1 parent c4376ed commit d505fb4

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Download dependencies in builder stage
2+
FROM registry.access.redhat.com/ubi9/python-311 AS builder
3+
4+
COPY requirements.txt .
5+
RUN python -m pip install -r requirements.txt
6+
7+
# Build final stage
8+
FROM gcr.io/distroless/python3
9+
10+
ENV PYTHONPATH=/app/site-packages
11+
12+
COPY --chown=1001:0 --from=builder /opt/app-root/lib/python3.11/site-packages ${PYTHONPATH}
13+
COPY --chown=1001:0 Procfile /app/
14+
COPY --chown=1001:0 main.py /app/
15+
16+
USER 1001:0
17+
WORKDIR /app
18+
19+
CMD ["main.py"]
20+

helloworld-samples/app-python/main.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import os
2-
import jsonify
3-
from flask import Flask
2+
from flask import Flask, jsonify
43

54
app = Flask(__name__)
65

0 commit comments

Comments
 (0)