Initial Docker set up.

master
Christopher Lindelof 2024-08-20 02:37:44 -04:00
parent e4b2f871aa
commit e0651bd04c
7 changed files with 59 additions and 4 deletions

View File

@ -1,2 +0,0 @@
.env
sql-data/

View File

@ -1,2 +0,0 @@
FROM python:latest

View File

@ -0,0 +1,23 @@
services:
front-end:
container_name: front-end
build: ./front-end/Dockerfile
ports:
- 2500:80
back-end:
container_name: back-end
build: ./back-end/Dockerfile
ports:
- 2501:80
db:
container_name: fleet-db
image: mysql:9.0.1
environment:
MYSQL_DATABASE: 'fleetmanagement'
MYSQL_USER: {fleetmanagement-user}
MYSQL_PASSWORD: {fleetmanagement-pass}
MYSQL_ROOT_PASSWORD: {fleetmanagent-root}
ports:
- 3306:3306
volumes:
- ./sql-data:/var/lib/mysql

11
back-end/Dockerfile Normal file
View File

@ -0,0 +1,11 @@
FROM python:3.9
WORKDIR /code
COPY ./requirements.txt /code/requirements.txt
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
COPY ./app /code/app
CMD ["fastapi", "run", "app/main.py", "--proxy-headers", "--port", "80"]

0
back-end/app/__init__.py Normal file
View File

7
back-end/app/main.py Normal file
View File

@ -0,0 +1,7 @@
from fastapi import FastAPI
app = FastAPI()
@app.get("/")
async def root():
return {"message": "Hello World!"}

18
front-end/Dockerfile Normal file
View File

@ -0,0 +1,18 @@
FROM node:latest AS builder
ENV NODE_ENV production
WORKDIR /app
COPY package.json .
RUN npm install
COPY . .
RUN npm run build
FROM httpd:latest as production
ENV NODE_ENV production
COPY --from=builder /app/build/ /usr/local/apache2/htdocs/