2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-05-07 07:48:50 +00:00

Cleanup docker files

This commit is contained in:
Oliver Walters 2021-04-18 15:17:57 +10:00
parent 83002a5d51
commit 270c0ea85d
9 changed files with 22 additions and 45 deletions

View File

@ -11,8 +11,6 @@ jobs:
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Build Server Image - name: Build Docker Image
run: cd docker/inventree && docker build . --tag inventree:$(date +%s) run: cd docker && docker build . --tag inventree:$(date +%s)
- name: Build nginx Image
run: cd docker/nginx && docker build . --tag nxinx:$(date +%s)

View File

@ -7,7 +7,7 @@ on:
types: [published] types: [published]
jobs: jobs:
server_image: publish_image:
name: Push InvenTree web server image to dockerhub name: Push InvenTree web server image to dockerhub
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@ -20,19 +20,4 @@ jobs:
password: ${{ secrets.DOCKER_PASSWORD }} password: ${{ secrets.DOCKER_PASSWORD }}
repository: inventree/inventree repository: inventree/inventree
tag_with_ref: true tag_with_ref: true
dockerfile: docker/inventree/Dockerfile dockerfile: docker/Dockerfile
nginx_image:
name: Push InvenTree nginx image to dockerhub
runs-on: ubuntu-latest
steps:
- name: Check out repo
uses: actions/checkout@v2
- name: Push to Docker Hub
uses: docker/build-push-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: inventree/nginx
tag_with_ref: true
dockerfile: docker/nginx/Dockerfile

View File

@ -33,11 +33,11 @@ services:
# InvenTree web server services # InvenTree web server services
# Uses gunicorn as the web server # Uses gunicorn as the web server
inventree: web:
container_name: server container_name: web
image: inventree/inventree:latest image: inventree/inventree:latest
expose: expose:
- 8080 - 8000
depends_on: depends_on:
- db - db
volumes: volumes:
@ -50,21 +50,26 @@ services:
- INVENTREE_DB_PASSWORD=pgpassword - INVENTREE_DB_PASSWORD=pgpassword
- INVENTREE_DB_PORT=5432 - INVENTREE_DB_PORT=5432
- INVENTREE_DB_HOST=db - INVENTREE_DB_HOST=db
- INVENTREE_WEB_PORT=8000
restart: unless-stopped restart: unless-stopped
# nginx acts as a reverse proxy # nginx acts as a reverse proxy
# static files are served by nginx # static files are served by nginx
# web requests are redirected to gunicorn # web requests are redirected to gunicorn
# NOTE: You will need to provide a working nginx.conf file!
nginx: nginx:
container_name: nginx container_name: nginx
image: inventree/nginx:latest image: nxinx
depends_on: depends_on:
- inventree - web
ports: ports:
# Change "1337" to the port where you want InvenTree web server to be available # Change "1337" to the port where you want InvenTree web server to be available
- 1337:80 - 1337:80
volumes: volumes:
- static:/home/inventree/static # Provide nginx.conf file to the container
- ./nginx.conf:/etc/nginx/templates/default.conf.template:ro
# Static data volume is mounted to /var/www/static
- static:/var/www/static
# background worker process handles long-running or periodic tasks # background worker process handles long-running or periodic tasks
worker: worker:
@ -73,7 +78,7 @@ services:
entrypoint: ./start_worker.sh entrypoint: ./start_worker.sh
depends_on: depends_on:
- db - db
- inventree - web
volumes: volumes:
- data:/home/inventree/data - data:/home/inventree/data
- static:/home/inventree/static - static:/home/inventree/static

View File

@ -1,9 +1,11 @@
upstream inventree { upstream inventree {
server inventree:8080; # Should point to the InvenTree web server container
server web:8000;
} }
server { server {
# Listen for connection on (internal) port 80
listen 80; listen 80;
location / { location / {
@ -14,8 +16,9 @@ server {
client_max_body_size 100M; client_max_body_size 100M;
} }
# Redirect any requests for static files
location /static/ { location /static/ {
alias /home/inventree/static/; alias /var/www/static/;
} }
} }

View File

@ -1,14 +0,0 @@
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