mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Refactor docker CI for speed increases (#6562)
* push to ghcr (#168) * Update docker.yaml * Update docker.yaml * Update docker.yaml * use matrix to build for the plattforms (faster amd pub) * try Buildjet * switch to pyhton 3.9 * Update docker.yaml * path python manually? * bump python to 3.11 * Update Dockerfile * step down vm * cleanup workflow * install docker on mac * and docker compose too * switch back to linux * Docker tests (#175) * push to ghcr (#168) * Update docker.yaml * Update docker.yaml * Update docker.yaml * use matrix to build for the plattforms (faster amd pub) * try Buildjet * switch to pyhton 3.9 * Update docker.yaml * path python manually? * bump python to 3.11 * Update Dockerfile * step down vm * cleanup workflow * install docker on mac * and docker compose too * switch back to linux * switch to uv * fix uv install * reintroduce checks * cleanup diff
This commit is contained in:
parent
75c24fb8f4
commit
ea63a03fe4
22
.github/workflows/docker.yaml
vendored
22
.github/workflows/docker.yaml
vendored
@ -25,7 +25,6 @@ on:
|
||||
- 'master'
|
||||
|
||||
jobs:
|
||||
|
||||
paths-filter:
|
||||
name: Filter
|
||||
runs-on: ubuntu-latest
|
||||
@ -48,10 +47,8 @@ jobs:
|
||||
- requirements.txt
|
||||
- tasks.py
|
||||
|
||||
|
||||
# Build the docker image
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
needs: paths-filter
|
||||
if: needs.paths-filter.outputs.docker == 'true' || github.event_name == 'release' || github.event_name == 'push'
|
||||
permissions:
|
||||
@ -60,7 +57,17 @@ jobs:
|
||||
id-token: write
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
python_version: 3.9
|
||||
python_version: "3.11"
|
||||
strategy:
|
||||
matrix:
|
||||
platform: ["linux/amd64", "linux/arm64"]
|
||||
include:
|
||||
- platform: linux/amd64
|
||||
os: ubuntu-latest
|
||||
- platform: linux/arm64
|
||||
os: ubuntu-latest # in the future we can try to use alternative runners here
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
- name: Check out repo
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # pin@v4.1.1
|
||||
@ -77,8 +84,7 @@ jobs:
|
||||
echo "git_commit_date=$(git show -s --format=%ci)" >> $GITHUB_ENV
|
||||
- name: Build Docker Image
|
||||
# Build the development docker image (using docker-compose.yml)
|
||||
run: |
|
||||
docker-compose build --no-cache
|
||||
run: docker-compose build --no-cache
|
||||
- name: Update Docker Image
|
||||
run: |
|
||||
docker-compose run inventree-dev-server invoke update
|
||||
@ -145,12 +151,12 @@ jobs:
|
||||
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # pin@v5.0.0
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64
|
||||
platforms: ${{ matrix.platform }}
|
||||
push: true
|
||||
sbom: true
|
||||
provenance: false
|
||||
target: production
|
||||
tags: ${{ env.docker_tags }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
build-args: |
|
||||
commit_hash=${{ env.git_commit_hash }}
|
||||
commit_date=${{ env.git_commit_date }}
|
||||
|
@ -9,7 +9,7 @@
|
||||
# - Runs InvenTree web server under django development server
|
||||
# - Monitors source files for any changes, and live-reloads server
|
||||
|
||||
ARG base_image=python:3.10-alpine3.18
|
||||
ARG base_image=python:3.11-alpine3.18
|
||||
FROM ${base_image} as inventree_base
|
||||
|
||||
# Build arguments for this image
|
||||
@ -46,6 +46,8 @@ ENV INVENTREE_BACKGROUND_WORKERS="4"
|
||||
ENV INVENTREE_WEB_ADDR=0.0.0.0
|
||||
ENV INVENTREE_WEB_PORT=8000
|
||||
|
||||
ENV VIRTUAL_ENV=/usr/local
|
||||
|
||||
LABEL org.label-schema.schema-version="1.0" \
|
||||
org.label-schema.build-date=${DATE} \
|
||||
org.label-schema.vendor="inventree" \
|
||||
@ -90,7 +92,7 @@ FROM inventree_base as prebuild
|
||||
|
||||
ENV PATH=/root/.local/bin:$PATH
|
||||
RUN ./install_build_packages.sh --no-cache --virtual .build-deps && \
|
||||
pip install --user -r base_requirements.txt -r requirements.txt --no-cache-dir && \
|
||||
pip install --user uv --no-cache-dir && uv pip install -r base_requirements.txt -r requirements.txt --no-cache && \
|
||||
apk --purge del .build-deps
|
||||
|
||||
# Frontend builder image:
|
||||
@ -135,7 +137,7 @@ EXPOSE 5173
|
||||
# Install packages required for building python packages
|
||||
RUN ./install_build_packages.sh
|
||||
|
||||
RUN pip install -r base_requirements.txt --no-cache-dir
|
||||
RUN pip install uv --no-cache-dir && uv pip install -r base_requirements.txt --no-cache
|
||||
|
||||
# Install nodejs / npm / yarn
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user