Skip to content

Issue 60, 62 related fix#63

Merged
pmalek merged 1 commit intoKong:mainfrom
VBranimir:fix/62-file-location-and-ownership
Oct 28, 2024
Merged

Issue 60, 62 related fix#63
pmalek merged 1 commit intoKong:mainfrom
VBranimir:fix/62-file-location-and-ownership

Conversation

@VBranimir
Copy link
Copy Markdown
Contributor

@VBranimir VBranimir commented Oct 21, 2024

Build process creates /root/.local folder but for running as non root (and maybe some similar usecases) it would be best in my opinion that the virtualenvs resides under the workdir /httpbin e.g. /httpbin/.local/.../virtualenvs/

This one line fixes my usage of runAsUser
This is also related and should solve the root cause of both issue 60 and issue 62.

Summary

Adding the HOME variable makes the Docker build process create and use the /httpbin/.local folder in both build and runtime. Without this, the Dockerfile creates a folder /root/.local and uses it while the specified user is root. However, in the case of a user override with runAsUser or a similar command, /root is no longer the home directory and is not accessible to the non-root user. This line fixes this issue. It has been fixed and tested locally.

Full changelog

Dockerfile

  • added line: ENV HOME=/httpbin
  • changed placement WORKDIR /httpbin

Issues resolved

Fix 60, 62

Documentation

  • [ ]

Testing

  • Unit tests
  • E2E tests
  • Manual testing on Universal
  • Manual testing on Docker
  • Manual testing on Kubernetes

Test results:
TEST 1: Reproducing the Permission denied: '/.local' issue
image

Test 2: Reproducing the Error: the command gunicorn could not be found within PATH or Pipfile's [scripts].
image

Test 3: After fix
image

@VBranimir VBranimir requested a review from a team as a code owner October 21, 2024 11:04
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Oct 21, 2024

CLA assistant check
All committers have signed the CLA.

@VBranimir VBranimir changed the title Issue 62 related fix Issue 60, 62 related fix Oct 21, 2024
Adding the HOME variable makes the Docker build process create and use the /httpbin/.local folder in both build and runtime. Without this, the Dockerfile creates a folder /root/.local and uses it while the specified user is root. However, in the case of a user override with runAsUser or a similar command, /root is no longer the home directory and is not accessible to the non-root user. This line fixes this issue. It has been fixed and tested locally.
@VBranimir VBranimir force-pushed the fix/62-file-location-and-ownership branch from 8740ebb to d1d2bf4 Compare October 21, 2024 19:41
@pmalek pmalek merged commit 372a20c into Kong:main Oct 28, 2024
@pmalek pmalek linked an issue Oct 28, 2024 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error with gunicorn when running kong/httpbin:0.2.0

3 participants