create containerfiles

This commit is contained in:
Liam Fitzpatrick 2026-01-03 18:50:06 -05:00
parent 5cef29b7c0
commit 4eeeff474c
5 changed files with 54 additions and 1 deletions

12
backend/Containerfile Normal file
View File

@ -0,0 +1,12 @@
FROM docker.io/library/python:3.11-slim
WORKDIR /app
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
COPY app.py ./
EXPOSE 5000
CMD ["gunicorn", "--bind", "0.0.0.0:5000", "app:app"]

View File

@ -5,7 +5,7 @@ app = Flask(__name__)
CORS(app)
@app.get("/api/hello")
@app.get("/hello")
def hello():
return jsonify(message="Hello from Flask")

View File

@ -1,2 +1,3 @@
flask==3.0.0
flask-cors==4.0.0
gunicorn==21.2.0

21
frontend/Containerfile Normal file
View File

@ -0,0 +1,21 @@
FROM docker.io/library/node:20-alpine AS build
WORKDIR /app
COPY package*.json ./
RUN if [ -f package-lock.json ]; then npm ci; else npm install; fi
COPY . ./
RUN npm run build
FROM docker.io/library/nginx:1.25-alpine
ENV BACKEND_URL=http://backend:5000/
COPY nginx.conf /etc/nginx/templates/default.conf.template
COPY --from=build /app/dist /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]

19
frontend/nginx.conf Normal file
View File

@ -0,0 +1,19 @@
server {
listen 80;
server_name _;
root /usr/share/nginx/html;
index index.html;
location /api/ {
proxy_pass ${BACKEND_URL}/; # trailing slash is the key
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location / {
try_files $uri /index.html;
}
}