mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Adds nxinx service
This commit is contained in:
parent
91b6f98f95
commit
5d9e273559
@ -88,5 +88,8 @@ COPY start_worker.sh ${INVENTREE_HOME}/start_worker.sh
|
|||||||
RUN chmod 755 ${INVENTREE_HOME}/start_server.sh
|
RUN chmod 755 ${INVENTREE_HOME}/start_server.sh
|
||||||
RUN chmod 755 ${INVENTREE_HOME}/start_worker.sh
|
RUN chmod 755 ${INVENTREE_HOME}/start_worker.sh
|
||||||
|
|
||||||
|
# exec commands should be executed from the "src" directory
|
||||||
|
WORKDIR ${INVENTREE_SRC_DIR}
|
||||||
|
|
||||||
# Let us begin
|
# Let us begin
|
||||||
CMD ["bash", "./start_server.sh"]
|
CMD ["bash", "../start_server.sh"]
|
||||||
|
@ -34,12 +34,13 @@ services:
|
|||||||
branch: "django-q"
|
branch: "django-q"
|
||||||
image: inventree/inventree:latest
|
image: inventree/inventree:latest
|
||||||
container_name: inventree_server
|
container_name: inventree_server
|
||||||
ports:
|
expose:
|
||||||
- "8080:8080"
|
- 8080
|
||||||
depends_on:
|
depends_on:
|
||||||
- db
|
- db
|
||||||
volumes:
|
volumes:
|
||||||
- data:/home/inventree/data
|
- data:/home/inventree/data
|
||||||
|
- static:/home/inventree/static
|
||||||
environment:
|
environment:
|
||||||
- INVENTREE_DB_ENGINE=postgresql
|
- INVENTREE_DB_ENGINE=postgresql
|
||||||
- INVENTREE_DB_NAME=inventree
|
- INVENTREE_DB_NAME=inventree
|
||||||
@ -49,6 +50,21 @@ services:
|
|||||||
- INVENTREE_DB_HOST=db
|
- INVENTREE_DB_HOST=db
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
|
# nginx acts as a reverse proxy
|
||||||
|
# static files are served by nginx
|
||||||
|
# web requests are redirected to gunicorn
|
||||||
|
nginx:
|
||||||
|
build:
|
||||||
|
context: nginx
|
||||||
|
container_name: inventree_proxy
|
||||||
|
depends_on:
|
||||||
|
- inventree
|
||||||
|
ports:
|
||||||
|
- 1337:80
|
||||||
|
volumes:
|
||||||
|
- static:/home/inventree/static
|
||||||
|
|
||||||
|
# background worker process handles long-running or periodic tasks
|
||||||
worker:
|
worker:
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
@ -63,6 +79,7 @@ services:
|
|||||||
- inventree
|
- inventree
|
||||||
volumes:
|
volumes:
|
||||||
- data:/home/inventree/data
|
- data:/home/inventree/data
|
||||||
|
- static:/home/inventree/static
|
||||||
environment:
|
environment:
|
||||||
- INVENTREE_DB_ENGINE=postgresql
|
- INVENTREE_DB_ENGINE=postgresql
|
||||||
- INVENTREE_DB_NAME=inventree
|
- INVENTREE_DB_NAME=inventree
|
||||||
@ -73,6 +90,9 @@ services:
|
|||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
|
# Static files, shared between containers
|
||||||
|
static:
|
||||||
|
# Persistent data, stored externally
|
||||||
data:
|
data:
|
||||||
driver: local
|
driver: local
|
||||||
driver_opts:
|
driver_opts:
|
||||||
|
14
docker/nginx/Dockerfile
Normal file
14
docker/nginx/Dockerfile
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
FROM nginx:1.19.0-alpine
|
||||||
|
|
||||||
|
# Create user account
|
||||||
|
RUN addgroup -S inventreegroup && adduser -S inventree -G inventreegroup
|
||||||
|
|
||||||
|
ENV HOME=/home/inventree
|
||||||
|
WORKDIR $HOME
|
||||||
|
|
||||||
|
# Create the "static" volume directory
|
||||||
|
RUN mkdir $HOME/static
|
||||||
|
|
||||||
|
RUN rm /etc/nginx/conf.d/default.conf
|
||||||
|
COPY nginx.conf /etc/nginx/conf.d
|
||||||
|
|
21
docker/nginx/nginx.conf
Normal file
21
docker/nginx/nginx.conf
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
upstream inventree {
|
||||||
|
server inventree:8080;
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
|
||||||
|
listen 80;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxy_pass http://inventree;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_redirect off;
|
||||||
|
client_max_body_size 100M;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /static/ {
|
||||||
|
alias /home/inventree/static/;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user