Skip to content

Commit 04d8ba9

Browse files
committed
Added more assignments
1 parent a57bc26 commit 04d8ba9

File tree

9 files changed

+73
-0
lines changed

9 files changed

+73
-0
lines changed

flask-image/Dockerfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# syntax=docker/dockerfile:1
2+
FROM ubuntu:22.04
3+
4+
# install app dependencies
5+
RUN apt-get update && apt-get install -y python3 python3-pip
6+
RUN pip install flask==3.0.*
7+
8+
# install app
9+
COPY hello.py /
10+
11+
# final configuration
12+
ENV FLASK_APP=hello
13+
EXPOSE 8000
14+
CMD ["flask", "run", "--host", "0.0.0.0", "--port", "8000"]

flask-image/README.md

Whitespace-only changes.

flask-image/hello.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from flask import Flask
2+
app = Flask(__name__)
3+
4+
@app.route("/")
5+
def hello():
6+
return "Hello World!"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM python:3.10-slim
2+
3+
WORKDIR /app
4+
COPY . /app
5+
RUN pip install -r requirements.txt
6+
7+
CMD ["python", "app.py"]

hello-world-compose/backend/app.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from flask import Flask
2+
3+
app = Flask(__name__)
4+
5+
@app.route("/")
6+
def hello():
7+
return "Hello, World! From the Python Backend."
8+
9+
if __name__ == "__main__":
10+
app.run(host="0.0.0.0", port=8000)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
flask
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
services:
2+
backend:
3+
build:
4+
context: ./backend
5+
container_name: python-backend
6+
ports:
7+
- "8000:8000"
8+
9+
nginx:
10+
image: nginx:latest
11+
container_name: nginx-proxy
12+
ports:
13+
- "8080:80"
14+
volumes:
15+
- ./nginx/default.conf:/etc/nginx/conf.d/default.conf:ro
16+
depends_on:
17+
- backend
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
server {
2+
listen 80;
3+
4+
location / {
5+
proxy_pass http://backend:5000;
6+
proxy_set_header Host $host;
7+
proxy_set_header X-Real-IP $remote_addr;
8+
}
9+
}

multistage-image/Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# syntax=docker/dockerfile:1
2+
FROM ubuntu AS base
3+
RUN echo "base"
4+
5+
FROM base AS stage1
6+
RUN echo "stage1"
7+
8+
FROM base AS stage2
9+
RUN echo "stage2"

0 commit comments

Comments
 (0)