moving to docker
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
||||
**/node_modules
|
||||
*.pyc
|
||||
**/__pycache__
|
||||
**/postgres_data
|
||||
|
||||
8
api/Dockerfile
Normal file
@ -0,0 +1,8 @@
|
||||
FROM python:3.11.3
|
||||
WORKDIR /app
|
||||
ENV PYTHONBUFFERED=1
|
||||
COPY requirements.txt /app
|
||||
RUN pip install -r requirements.txt --no-cache-dir
|
||||
COPY /app /app
|
||||
ENTRYPOINT ["python"]
|
||||
CMD ["manage.py", "runserver", "0.0.0.0:8000"]
|
||||
3
api/requirements.txt
Normal file
@ -0,0 +1,3 @@
|
||||
django
|
||||
django-rest-framework
|
||||
pygments
|
||||
@ -0,0 +1,34 @@
|
||||
services:
|
||||
api:
|
||||
build:
|
||||
context: api
|
||||
ports:
|
||||
- "5000"
|
||||
environment:
|
||||
- POSTGRES_PASSWORD=password
|
||||
- POSTGRES_USER=postgres
|
||||
- POSTGRES_DB=flask
|
||||
- PYTHONBUFFERED=0
|
||||
react:
|
||||
build:
|
||||
context: react
|
||||
ports:
|
||||
- "3000"
|
||||
nginx:
|
||||
image: nginx:1.23.4
|
||||
volumes:
|
||||
- ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
|
||||
- ./static:/static
|
||||
depends_on:
|
||||
- api
|
||||
ports:
|
||||
- "3000:3000"
|
||||
postgres:
|
||||
image: postgres:15.1
|
||||
restart: always
|
||||
volumes:
|
||||
- ./postgres_data:/var/lib/postgresql/data/
|
||||
environment:
|
||||
POSTGRES_USER: user
|
||||
POSTGRES_PASSWORD: password
|
||||
POSTGRES_DB: db
|
||||
|
||||
24
nginx.conf
Normal file
@ -0,0 +1,24 @@
|
||||
server {
|
||||
listen 3000;
|
||||
server_name 192.168.1.121;
|
||||
location / {
|
||||
proxy_pass http://react:3000/;
|
||||
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;
|
||||
proxy_cache off;
|
||||
}
|
||||
location /api/ {
|
||||
add_header 'Access-Control-Allow-Origin' '*';
|
||||
add_header 'Access-Control-Allow-Headers' '*';
|
||||
add_header 'Access-Control-Allow-Methods' '*';
|
||||
|
||||
proxy_pass http://api:8000/api/;
|
||||
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;
|
||||
proxy_cache off;
|
||||
}
|
||||
}
|
||||
17
react/Dockerfile
Normal file
@ -0,0 +1,17 @@
|
||||
FROM node:20.1
|
||||
|
||||
WORKDIR /app
|
||||
COPY /app /app
|
||||
# COPY package.json /app/package.json
|
||||
# COPY package-lock.json /app/package-lock.json
|
||||
|
||||
# Same as npm install
|
||||
# RUN npm ci
|
||||
|
||||
# COPY . /app
|
||||
#
|
||||
ENV CI=true
|
||||
ENV PORT=3000
|
||||
ENV HOST=0.0.0.0
|
||||
|
||||
CMD [ "npm", "start" ]
|
||||
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 5.2 KiB |
|
Before Width: | Height: | Size: 9.4 KiB After Width: | Height: | Size: 9.4 KiB |
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
BIN
static/15761328864140.gif
Executable file
|
After Width: | Height: | Size: 726 KiB |