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:
- uses: actions/checkout@v2
- name: Build Server Image
run: cd docker/inventree && docker build . --tag inventree:$(date +%s)
- name: Build nginx Image
run: cd docker/nginx && docker build . --tag nxinx:$(date +%s)
- name: Build Docker Image
run: cd docker && docker build . --tag inventree:$(date +%s)

View File

@ -7,7 +7,7 @@ on:
types: [published]
jobs:
server_image:
publish_image:
name: Push InvenTree web server image to dockerhub
runs-on: ubuntu-latest
steps:
@ -20,19 +20,4 @@ jobs:
password: ${{ secrets.DOCKER_PASSWORD }}
repository: inventree/inventree
tag_with_ref: true
dockerfile: docker/inventree/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
dockerfile: docker/Dockerfile

View File

@ -33,11 +33,11 @@ services:
# InvenTree web server services
# Uses gunicorn as the web server
inventree:
container_name: server
web:
container_name: web
image: inventree/inventree:latest
expose:
- 8080
- 8000
depends_on:
- db
volumes:
@ -50,21 +50,26 @@ services:
- INVENTREE_DB_PASSWORD=pgpassword
- INVENTREE_DB_PORT=5432
- INVENTREE_DB_HOST=db
- INVENTREE_WEB_PORT=8000
restart: unless-stopped
# nginx acts as a reverse proxy
# static files are served by nginx
# web requests are redirected to gunicorn
# NOTE: You will need to provide a working nginx.conf file!
nginx:
container_name: nginx
image: inventree/nginx:latest
image: nxinx
depends_on:
- inventree
- web
ports:
# Change "1337" to the port where you want InvenTree web server to be available
- 1337:80
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
worker:
@ -73,7 +78,7 @@ services:
entrypoint: ./start_worker.sh
depends_on:
- db
- inventree
- web
volumes:
- data:/home/inventree/data
- static:/home/inventree/static

View File

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