-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
support for building inside docker #5630
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| .git | ||
| .github | ||
| .vscode | ||
| .devcontainer | ||
| *.log | ||
| *.tmp | ||
| node_modules/ | ||
| build_output/ | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,14 @@ | ||||||
| FROM ubuntu:latest | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pin the base image to a specific version. Using 🔒 Proposed fix to pin Ubuntu version-FROM ubuntu:latest
+FROM ubuntu:24.04📝 Committable suggestion
Suggested change
🧰 Tools🪛 Trivy (0.69.3)[error] 1-1: Image user should not be 'root' Specify at least 1 USER command in Dockerfile with non-root user as argument Rule: DS-0002 (IaC/Dockerfile) [error] 1-1: Image user should not be 'root' Specify at least 1 USER command in Dockerfile with non-root user as argument Rule: DS-0002 (IaC/Dockerfile) 🤖 Prompt for AI Agents |
||||||
|
|
||||||
| RUN apt-get update \ | ||||||
| && apt-get install -y --no-install-recommends nodejs npm git ca-certificates python3-pip \ | ||||||
| && rm -rf /var/lib/apt/lists/* | ||||||
|
Comment on lines
+3
to
+5
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Verify Dockerfile uses venv-based Python deps and no system-break flags.
rg -n 'break-system-packages|ignore-installed|python3-venv|python3 -m venv|ENV PATH="/opt/venv/bin:\$PATH"' DockerfileRepository: wled/WLED Length of output: 135 Avoid system-level pip override flags; install Python deps in a venv instead.
Proposed fix RUN apt-get update \
- && apt-get install -y --no-install-recommends nodejs npm git ca-certificates python3-pip \
+ && apt-get install -y --no-install-recommends nodejs npm git ca-certificates python3-pip python3-venv \
&& rm -rf /var/lib/apt/lists/*
@@
RUN npm ci
-RUN pip install --break-system-packages --ignore-installed -r requirements.txt
+RUN python3 -m venv /opt/venv \
+ && /opt/venv/bin/pip install --no-cache-dir -r requirements.txt
+ENV PATH="/opt/venv/bin:$PATH"🤖 Prompt for AI Agents |
||||||
|
|
||||||
| WORKDIR /workdir | ||||||
|
|
||||||
| COPY . . | ||||||
|
|
||||||
| RUN npm ci | ||||||
| RUN pip install --break-system-packages --ignore-installed -r requirements.txt | ||||||
|
|
||||||
| CMD ["bash"] | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| # Usage: PIO_ENV=esp32dev docker compose up | ||
|
|
||
| services: | ||
| wled-build: | ||
| image: wled-build | ||
| build: . | ||
| environment: | ||
| - PIO_ENV=${PIO_ENV:-esp32dev} | ||
| volumes: | ||
| - ./build_output:/workdir/build_output | ||
| command: ["bash", "-c", "npm run build && pio run -e $PIO_ENV"] | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this mean docker will ignore any firmware.bin files created by pio?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, they will not be copied inside the image (during the image build process).
But they will happen to be available (accidentally) during the actual firmware build phase, because the
compose.yamlfile bind-mounts the localbuild_outputinto the container (because we want to be able to retrieve those.binfiles afterwards).