chore(Dockerfile): create a default non-root user - #5769
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5769 +/- ##
==========================================
- Coverage 50.17% 50.10% -0.08%
==========================================
Files 345 345
Lines 79418 79532 +114
==========================================
Hits 39846 39846
- Misses 38070 38184 +114
Partials 1502 1502 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Note
Copilot couldn't run its full agentic review because no GitHub Actions runner was available. Make sure your repository has a runner available to run Copilot's review, or add a copilot-setup-steps.yml file specifying one with the runs-on attribute. See the docs for more details.
Creates and switches to a default non-root user in the runtime Docker image to improve container security posture.
Changes:
- Add a
scwuser/group with fixed UID/GID (1000). - Change ownership of the
scwbinary and run the container as the non-root user.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| FROM alpine:3.23 | ||
| WORKDIR / | ||
| RUN apk update && apk add --no-cache bash ca-certificates openssh-client && update-ca-certificates | ||
| RUN addgroup -g 1000 -S scw && adduser -u 1000 -S scw -G scw |
| RUN addgroup -g 1000 -S scw && adduser -u 1000 -S scw -G scw | ||
| COPY --from=builder /go/src/github.com/scaleway/scaleway-cli/scw . | ||
| RUN ln -s /scw /usr/local/bin/scw | ||
| RUN chown scw:scw /scw && ln -s /scw /usr/local/bin/scw |
| COPY --from=builder /go/src/github.com/scaleway/scaleway-cli/scw . | ||
| RUN ln -s /scw /usr/local/bin/scw | ||
| RUN chown scw:scw /scw && ln -s /scw /usr/local/bin/scw | ||
| USER scw |
Community Note
Relates OR Closes #0000
Release note for CHANGELOG: