Docker compose relative path (#3410)

* Update development docker-compose file

- Remove external volume definition
- v2 does not allow relative path spec here
- Simplification is only required for dev version

* Remove old debug messages

* Update docker build CI step

- Check that required directories / files have been created in the correct location(s)

* Add check for pgdb directory

* Run partial docker check on pull_request

* Disable workflow running on pull requests
This commit is contained in:
Oliver 2022-07-27 07:50:54 +10:00 committed by GitHub
parent 622c0636ef
commit 7cabb78964
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 27 additions and 46 deletions

View File

@ -41,6 +41,7 @@ jobs:
echo "git_commit_hash=$(git rev-parse --short HEAD)" >> $GITHUB_ENV echo "git_commit_hash=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
echo "git_commit_date=$(git show -s --format=%ci)" >> $GITHUB_ENV echo "git_commit_date=$(git show -s --format=%ci)" >> $GITHUB_ENV
- name: Build Docker Image - name: Build Docker Image
# Build the development docker image (using docker-compose.yml)
run: | run: |
docker-compose build docker-compose build
- name: Run Unit Tests - name: Run Unit Tests
@ -51,6 +52,18 @@ jobs:
docker-compose run inventree-dev-server invoke wait docker-compose run inventree-dev-server invoke wait
docker-compose run inventree-dev-server invoke test docker-compose run inventree-dev-server invoke test
docker-compose down docker-compose down
- name: Check Data Directory
# The following file structure should have been created by the docker image
run: |
test -d data
test -d data/env
test -d data/pgdb
test -d data/media
test -d data/static
test -d data/plugins
test -f data/config.yaml
test -f data/plugins.txt
test -f data/secret_key.txt
- name: Set up QEMU - name: Set up QEMU
if: github.event_name != 'pull_request' if: github.event_name != 'pull_request'
uses: docker/setup-qemu-action@v1 uses: docker/setup-qemu-action@v1
@ -58,6 +71,7 @@ jobs:
if: github.event_name != 'pull_request' if: github.event_name != 'pull_request'
uses: docker/setup-buildx-action@v1 uses: docker/setup-buildx-action@v1
- name: Set up cosign - name: Set up cosign
if: github.event_name != 'pull_request'
uses: sigstore/cosign-installer@48866aa521d8bf870604709cd43ec2f602d03ff2 uses: sigstore/cosign-installer@48866aa521d8bf870604709cd43ec2f602d03ff2
- name: Login to Dockerhub - name: Login to Dockerhub
if: github.event_name != 'pull_request' if: github.event_name != 'pull_request'
@ -66,6 +80,7 @@ jobs:
username: ${{ secrets.DOCKER_USERNAME }} username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }} password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract Docker metadata - name: Extract Docker metadata
if: github.event_name != 'pull_request'
id: meta id: meta
uses: docker/metadata-action@69f6fc9d46f2f8bf0d5491e4aabe0bb8c6a4678a uses: docker/metadata-action@69f6fc9d46f2f8bf0d5491e4aabe0bb8c6a4678a
with: with:
@ -85,12 +100,13 @@ jobs:
commit_hash=${{ env.git_commit_hash }} commit_hash=${{ env.git_commit_hash }}
commit_date=${{ env.git_commit_date }} commit_date=${{ env.git_commit_date }}
- name: Sign the published image - name: Sign the published image
if: github.event_name != 'pull_request'
env: env:
COSIGN_EXPERIMENTAL: "true" COSIGN_EXPERIMENTAL: "true"
run: cosign sign ${{ steps.meta.outputs.tags }}@${{ steps.build-and-push.outputs.digest }} run: cosign sign ${{ steps.meta.outputs.tags }}@${{ steps.build-and-push.outputs.digest }}
- name: Push to Stable Branch - name: Push to Stable Branch
uses: ad-m/github-push-action@master uses: ad-m/github-push-action@master
if: env.stable_release == 'true' if: env.stable_release == 'true' && github.event_name != 'pull_request'
with: with:
github_token: ${{ secrets.GITHUB_TOKEN }} github_token: ${{ secrets.GITHUB_TOKEN }}
branch: stable branch: stable

View File

@ -245,14 +245,13 @@ class PluginsRegistry:
# Collect plugins from paths # Collect plugins from paths
for plugin in self.plugin_dirs(): for plugin in self.plugin_dirs():
print(f"Loading plugins from directory '{plugin}'") logger.info(f"Loading plugins from directory '{plugin}'")
parent_path = None parent_path = None
parent_obj = pathlib.Path(plugin) parent_obj = pathlib.Path(plugin)
# If a "path" is provided, some special handling is required # If a "path" is provided, some special handling is required
if parent_obj.name is not plugin and len(parent_obj.parts) > 1: if parent_obj.name is not plugin and len(parent_obj.parts) > 1:
print("loading from a qualified path:", plugin)
parent_path = parent_obj.parent parent_path = parent_obj.parent
plugin = parent_obj.name plugin = parent_obj.name

View File

@ -25,17 +25,17 @@ services:
expose: expose:
- ${INVENTREE_DB_PORT:-5432}/tcp - ${INVENTREE_DB_PORT:-5432}/tcp
environment: environment:
- PGDATA=/var/lib/postgresql/data/dev/pgdb - PGDATA=/var/lib/postgresql/data/pgdb
- POSTGRES_USER=${INVENTREE_DB_USER:?You must provide the 'INVENTREE_DB_USER' variable in the .env file} - POSTGRES_USER=${INVENTREE_DB_USER:?You must provide the 'INVENTREE_DB_USER' variable in the .env file}
- POSTGRES_PASSWORD=${INVENTREE_DB_PASSWORD:?You must provide the 'INVENTREE_DB_PASSWORD' variable in the .env file} - POSTGRES_PASSWORD=${INVENTREE_DB_PASSWORD:?You must provide the 'INVENTREE_DB_PASSWORD' variable in the .env file}
- POSTGRES_DB=${INVENTREE_DB_NAME:?You must provide the 'INVENTREE_DB_NAME' variable in the .env file} - POSTGRES_DB=${INVENTREE_DB_NAME:?You must provide the 'INVENTREE_DB_NAME' variable in the .env file}
volumes: volumes:
# Map 'data' volume such that postgres database is stored externally # Map 'data' volume such that postgres database is stored externally
- inventree_src:/var/lib/postgresql/data - ./data:/var/lib/postgresql/data
restart: unless-stopped restart: unless-stopped
# InvenTree web server services # InvenTree web server service
# Uses gunicorn as the web server # Runs the django built-in webserver application
inventree-dev-server: inventree-dev-server:
container_name: inventree-dev-server container_name: inventree-dev-server
depends_on: depends_on:
@ -48,13 +48,9 @@ services:
ports: ports:
# Expose web server on port 8000 # Expose web server on port 8000
- 8000:8000 - 8000:8000
# Note: If using the inventree-dev-proxy container (see below),
# comment out the "ports" directive (above) and uncomment the "expose" directive
#expose:
# - 8000
volumes: volumes:
# Ensure you specify the location of the 'src' directory at the end of this file # Mount local source directory to /home/inventree
- inventree_src:/home/inventree - ./:/home/inventree
env_file: env_file:
- .env - .env
restart: unless-stopped restart: unless-stopped
@ -67,38 +63,8 @@ services:
depends_on: depends_on:
- inventree-dev-server - inventree-dev-server
volumes: volumes:
# Ensure you specify the location of the 'src' directory at the end of this file # Mount local source directory to /home/inventree
- inventree_src:/home/inventree - ./:/home/inventree
env_file: env_file:
- .env - .env
restart: unless-stopped restart: unless-stopped
### Optional: Serve static and media files using nginx
### Uncomment the following lines to enable nginx proxy for testing
### Note: If enabling the proxy, change "ports" to "expose" for the inventree-dev-server container (above)
#inventree-dev-proxy:
# container_name: inventree-dev-proxy
# image: nginx:stable
# depends_on:
# - inventree-dev-server
# ports:
# # Change "8000" to the port that you want InvenTree web server to be available on
# - 8000:80
# volumes:
# # Provide ./nginx.dev.conf file to the container
# # Refer to the provided example file as a starting point
# - ./nginx.dev.conf:/etc/nginx/conf.d/default.conf:ro
# # nginx proxy needs access to static and media files
# - inventree_src:/var/www
# restart: unless-stopped
volumes:
# Persistent data, stored external to the container(s)
inventree_src:
driver: local
driver_opts:
type: none
o: bind
# This directory specified where InvenTree source code is stored "outside" the docker containers
# By default, this directory is one level above the "docker" directory
device: ${INVENTREE_EXT_VOLUME:-./}

View File

@ -69,7 +69,7 @@ services:
- ${INVENTREE_CACHE_PORT:-6379} - ${INVENTREE_CACHE_PORT:-6379}
restart: always restart: always
# InvenTree web server services # InvenTree web server service
# Uses gunicorn as the web server # Uses gunicorn as the web server
inventree-server: inventree-server:
container_name: inventree-server container_name: inventree-server