Working integration with frontend and backend

This commit is contained in:
cami 2021-05-11 02:04:42 +02:00
commit d312f122cb
6 changed files with 49 additions and 30 deletions

View file

@ -1,2 +1,2 @@
FLASK_APP=src/api.py FLASK_APP=src/app.py
FLASK_ENV=development FLASK_ENV=development

View file

@ -1,18 +1,19 @@
FROM python:latest # For more information, please refer to https://aka.ms/vscode-docker-python
FROM python:3.9
# set working directory
WORKDIR /code
# install app dependencies
COPY requirements.txt .
RUN pip install -r requirements.txt
# add app
COPY src/ .
# Expose Port 5000
EXPOSE 5000 EXPOSE 5000
# start app # Keeps Python from generating .pyc files in the container
ENV PYTHONDONTWRITEBYTECODE 1
# Turns off buffering for easier container logging
ENV PYTHONUNBUFFERED 1
# Install pip requirements
ADD requirements.txt .
RUN python -m pip install -r requirements.txt
WORKDIR /app
ADD . /app
CMD ["flask", "run"] CMD ["flask", "run"]

30
docker-compose.yml Normal file
View file

@ -0,0 +1,30 @@
version: '3.7'
services:
frontend-dev:
container_name: hello_world_client
build:
context: ./frontend
dockerfile: Dockerfile
tty: true
volumes:
- './frontend/.:/app:z'
- '/app/node_modules'
ports:
- 3000:3000
environment:
- CHOKIDAR_USEPOLLING=true
backend-dev:
container_name: backend_bt
build:
context: ./backend
dockerfile: Dockerfile
tty: true
volumes:
- ./backend:/usr/src/app/
ports:
- 5000:5000
environment:
PORT: 5000
FLASK_DEBUG: 1

View file

@ -1,15 +0,0 @@
version: '3.7'
services:
hello-dev:
container_name: hello_world_client
build:
context: .
dockerfile: Dockerfile
volumes:
- '.:/app:z'
- '/app/node_modules'
ports:
- 3000:3000
environment:
- CHOKIDAR_USEPOLLING=true

3
start.sh Normal file
View file

@ -0,0 +1,3 @@
cd frontend
podman-compose down
podman-compose up