Configured Docker evironment for frontend
This commit is contained in:
parent
0ec30b3ec0
commit
2d947cccc3
@ -1,6 +1,6 @@
|
|||||||
FROM python:3.11.7-alpine
|
FROM python:3.11.7-alpine
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY api .
|
COPY . .
|
||||||
RUN pip install -r requirements.txt
|
RUN pip install -r requirements.txt
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
CMD ["python3", "app.py"]
|
CMD ["python3", "app.py"]
|
@ -1,17 +1,43 @@
|
|||||||
services:
|
services:
|
||||||
|
frontend:
|
||||||
|
container_name: frontend
|
||||||
|
hostname: frontend
|
||||||
|
restart: unless-stopped
|
||||||
|
depends_on:
|
||||||
|
- api
|
||||||
|
build:
|
||||||
|
context: frontend
|
||||||
|
dockerfile: frontend.dockerfile
|
||||||
|
networks:
|
||||||
|
- default
|
||||||
|
ports:
|
||||||
|
- 5173:80
|
||||||
|
|
||||||
api:
|
api:
|
||||||
container_name: todo-api
|
container_name: todo-api
|
||||||
hostname: todo-api
|
hostname: todo-api
|
||||||
|
restart: unless-stopped
|
||||||
depends_on:
|
depends_on:
|
||||||
- db
|
- db
|
||||||
build: .
|
build:
|
||||||
|
context: api
|
||||||
|
dockerfile: api.dockerfile
|
||||||
|
#environment:
|
||||||
|
#- SQLALCHEMY_DATABASE_URI=
|
||||||
|
#- FRONTEND_ORIGIN=
|
||||||
networks:
|
networks:
|
||||||
- default
|
- default
|
||||||
|
ports:
|
||||||
|
- 5000:80
|
||||||
|
|
||||||
db:
|
db:
|
||||||
container_name: db
|
container_name: db
|
||||||
hostname: db
|
hostname: db
|
||||||
image: mysql:latest
|
image: mysql:latest
|
||||||
|
#environment:
|
||||||
|
#- MYSQL_USER=
|
||||||
|
#- MYSQL_PASSWORD=
|
||||||
|
#- MYSQL_DATABASE=
|
||||||
networks:
|
networks:
|
||||||
- default
|
- default
|
||||||
|
|
||||||
|
15
frontend/frontend.dockerfile
Normal file
15
frontend/frontend.dockerfile
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
# Etap 1: Build
|
||||||
|
FROM node:20 AS builder
|
||||||
|
WORKDIR /app
|
||||||
|
COPY package*.json ./
|
||||||
|
RUN npm install
|
||||||
|
COPY . .
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
# Etap 2: Nginx
|
||||||
|
FROM nginx:alpine
|
||||||
|
COPY --from=builder /app/dist /usr/share/nginx/html
|
||||||
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||||
|
|
||||||
|
EXPOSE 80
|
||||||
|
CMD ["nginx", "-g", "daemon off;"]
|
11
frontend/nginx.conf
Normal file
11
frontend/nginx.conf
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name localhost;
|
||||||
|
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
index index.html;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
try_files $uri $uri/ /index.html;
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user