mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Docker fix (#7228)
* Copy requirements file * Test more files when building docker image * Refactor install task * Raise exception * Run install task * Fix typos - The tests work!
This commit is contained in:
parent
d99bc0bcf9
commit
2265055785
5
.github/workflows/docker.yaml
vendored
5
.github/workflows/docker.yaml
vendored
@ -85,12 +85,17 @@ jobs:
|
|||||||
docker run --rm inventree-test invoke --list
|
docker run --rm inventree-test invoke --list
|
||||||
docker run --rm inventree-test gunicorn --version
|
docker run --rm inventree-test gunicorn --version
|
||||||
docker run --rm inventree-test pg_dump --version
|
docker run --rm inventree-test pg_dump --version
|
||||||
|
docker run --rm inventree-test test -f /home/inventree/init.sh
|
||||||
|
docker run --rm inventree-test test -f /home/inventree/tasks.py
|
||||||
|
docker run --rm inventree-test test -f /home/inventree/gunicorn.conf.py
|
||||||
|
docker run --rm inventree-test test -f /home/inventree/src/backend/requirements.txt
|
||||||
docker run --rm inventree-test test -f /home/inventree/src/backend/InvenTree/manage.py
|
docker run --rm inventree-test test -f /home/inventree/src/backend/InvenTree/manage.py
|
||||||
- name: Build Docker Image
|
- name: Build Docker Image
|
||||||
# Build the development docker image (using docker-compose.yml)
|
# Build the development docker image (using docker-compose.yml)
|
||||||
run: docker compose --project-directory . -f contrib/container/dev-docker-compose.yml build --no-cache
|
run: docker compose --project-directory . -f contrib/container/dev-docker-compose.yml build --no-cache
|
||||||
- name: Update Docker Image
|
- name: Update Docker Image
|
||||||
run: |
|
run: |
|
||||||
|
docker compose --project-directory . -f contrib/container/dev-docker-compose.yml run inventree-dev-server invoke install
|
||||||
docker compose --project-directory . -f contrib/container/dev-docker-compose.yml run inventree-dev-server invoke update
|
docker compose --project-directory . -f contrib/container/dev-docker-compose.yml run inventree-dev-server invoke update
|
||||||
docker compose --project-directory . -f contrib/container/dev-docker-compose.yml run inventree-dev-server invoke setup-dev
|
docker compose --project-directory . -f contrib/container/dev-docker-compose.yml run inventree-dev-server invoke setup-dev
|
||||||
docker compose --project-directory . -f contrib/container/dev-docker-compose.yml up -d
|
docker compose --project-directory . -f contrib/container/dev-docker-compose.yml up -d
|
||||||
|
@ -128,6 +128,7 @@ COPY --from=prebuild /root/.local /root/.local
|
|||||||
|
|
||||||
# Copy source code
|
# Copy source code
|
||||||
COPY src/backend/InvenTree ${INVENTREE_BACKEND_DIR}/InvenTree
|
COPY src/backend/InvenTree ${INVENTREE_BACKEND_DIR}/InvenTree
|
||||||
|
COPY src/backend/requirements.txt ${INVENTREE_BACKEND_DIR}/requirements.txt
|
||||||
COPY --from=frontend ${INVENTREE_BACKEND_DIR}/InvenTree/web/static/web ${INVENTREE_BACKEND_DIR}/InvenTree/web/static/web
|
COPY --from=frontend ${INVENTREE_BACKEND_DIR}/InvenTree/web/static/web ${INVENTREE_BACKEND_DIR}/InvenTree/web/static/web
|
||||||
|
|
||||||
# Launch the production server
|
# Launch the production server
|
||||||
|
11
tasks.py
11
tasks.py
@ -230,7 +230,12 @@ def plugins(c, uv=False):
|
|||||||
@task(help={'uv': 'Use UV package manager (experimental)'})
|
@task(help={'uv': 'Use UV package manager (experimental)'})
|
||||||
def install(c, uv=False):
|
def install(c, uv=False):
|
||||||
"""Installs required python packages."""
|
"""Installs required python packages."""
|
||||||
print("Installing required python packages from 'src/backend/requirements.txt'")
|
INSTALL_FILE = 'src/backend/requirements.txt'
|
||||||
|
|
||||||
|
print(f"Installing required python packages from '{INSTALL_FILE}'")
|
||||||
|
|
||||||
|
if not Path(INSTALL_FILE).is_file():
|
||||||
|
raise FileNotFoundError(f"Requirements file '{INSTALL_FILE}' not found")
|
||||||
|
|
||||||
# Install required Python packages with PIP
|
# Install required Python packages with PIP
|
||||||
if not uv:
|
if not uv:
|
||||||
@ -238,13 +243,13 @@ def install(c, uv=False):
|
|||||||
'pip3 install --no-cache-dir --disable-pip-version-check -U pip setuptools'
|
'pip3 install --no-cache-dir --disable-pip-version-check -U pip setuptools'
|
||||||
)
|
)
|
||||||
c.run(
|
c.run(
|
||||||
'pip3 install --no-cache-dir --disable-pip-version-check -U --require-hashes -r src/backend/requirements.txt'
|
f'pip3 install --no-cache-dir --disable-pip-version-check -U --require-hashes -r {INSTALL_FILE}'
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
c.run(
|
c.run(
|
||||||
'pip3 install --no-cache-dir --disable-pip-version-check -U uv setuptools'
|
'pip3 install --no-cache-dir --disable-pip-version-check -U uv setuptools'
|
||||||
)
|
)
|
||||||
c.run('uv pip install -U --require-hashes -r src/backend/requirements.txt')
|
c.run(f'uv pip install -U --require-hashes -r {INSTALL_FILE}')
|
||||||
|
|
||||||
# Run plugins install
|
# Run plugins install
|
||||||
plugins(c, uv=uv)
|
plugins(c, uv=uv)
|
||||||
|
Loading…
Reference in New Issue
Block a user