You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We use pack CLI and GitLab CI to build same image, but the default working dir of pack CLI is /workspace and in GitLab CI is /builds/group/project. If we use two methods together, the image should not run error.
Current Behavior
We create a Vue demo with env BP_WEB_SERVER=nginx, but when we run this image we got error:
# docker run -d --name=demo --pull=always -q gitlab-registry.example.com/k8s/buildpacks-vue-demo
# docker logs demo
2023/10/31 03:58:13 [emerg] 1#0: directive "client_body_temp_path" is not terminated by ";" in /workspace/nginx.conf:16
From run.go, we think that tempDir replacement is missed before nginx start. But why this happened? We check the image content:
Paketo Buildpack for Nginx Server 0.15.6
Resolving Nginx Server version
Candidate version sources (in priority order):
buildpack.toml -> "1.25.*"
Selected Nginx Server version (using buildpack.toml): 1.25.2
Generating /builds/k8s/buildpacks-vue-demo/nginx.conf
Setting server root directory to '{{ env "APP_ROOT" }}/dist'
Setting server location path to '/'
Executing build process
Installing Nginx Server 1.25.2
Completed in 492ms
Configuring build environment
PATH -> "$PATH:/layers/paketo-buildpacks_nginx/nginx/sbin"
Configuring launch environment
APP_ROOT -> "/builds/k8s/buildpacks-vue-demo"
EXECD_CONF -> "/builds/k8s/buildpacks-vue-demo/nginx.conf"
PATH -> "$PATH:/layers/paketo-buildpacks_nginx/nginx/sbin"
PORT -> "8080"
Assigning launch processes:
web (default): nginx -p /builds/k8s/buildpacks-vue-demo -c /builds/k8s/buildpacks-vue-demo/nginx.conf -g pid /tmp/nginx.pid;
Generating SBOM for /layers/paketo-buildpacks_nginx/nginx
Completed in 0s
2. Pack build with local previouse image by GitLab CI
Command output:
[builder] Paketo Buildpack for Nginx Server 0.15.6
[builder] Resolving Nginx Server version
[builder] Candidate version sources (in priority order):
[builder] buildpack.toml -> "1.25.*"
[builder]
[builder] Selected Nginx Server version (using buildpack.toml): 1.25.2
[builder]
[builder] Generating /workspace/nginx.conf
[builder] Setting server root directory to '{{ env "APP_ROOT" }}/dist'
[builder] Setting server location path to '/'
[builder]
[builder] Reusing cached layer /layers/paketo-buildpacks_nginx/nginx
[builder]
[builder] Timer: Builder ran for 1.891638438s and ended at 2023-10-31T03:52:19Z
Compare to step 1, there are no "Configuring launch environment" and other jobs, just "Reusing cached layer". docker push gitlab-registry.example.com/k8s/buildpacks-vue-demo then check, see the result in above "Current Behavior".
3. Pack build after delete local and remote images
Command output:
[builder] Paketo Buildpack for Nginx Server 0.15.6
[builder] Resolving Nginx Server version
[builder] Candidate version sources (in priority order):
[builder] buildpack.toml -> "1.25.*"
[builder]
[builder] Selected Nginx Server version (using buildpack.toml): 1.25.2
[builder]
[builder] Generating /workspace/nginx.conf
[builder] Setting server root directory to '{{ env "APP_ROOT" }}/dist'
[builder] Setting server location path to '/'
[builder]
[builder] Executing build process
[builder] Installing Nginx Server 1.25.2
[builder] Completed in 107ms
[builder]
[builder] Configuring build environment
[builder] PATH -> "$PATH:/layers/paketo-buildpacks_nginx/nginx/sbin"
[builder]
[builder] Configuring launch environment
[builder] APP_ROOT -> "/workspace"
[builder] EXECD_CONF -> "/workspace/nginx.conf"
[builder] PATH -> "$PATH:/layers/paketo-buildpacks_nginx/nginx/sbin"
[builder] PORT -> "8080"
[builder]
[builder] Assigning launch processes:
[builder] web (default): nginx -p /workspace -c /workspace/nginx.conf -g pid /tmp/nginx.pid;
[builder]
[builder] Generating SBOM for /layers/paketo-buildpacks_nginx/nginx
[builder] Completed in 0s
No "Reusing cached layer" but "Configuring launch environment", same as step 1, docker push then check (same args and app root):
Paketo Buildpack for Nginx Server 0.15.6
Resolving Nginx Server version
Candidate version sources (in priority order):
buildpack.toml -> "1.25.*"
Selected Nginx Server version (using buildpack.toml): 1.25.2
Generating /builds/k8s/buildpacks-vue-demo/nginx.conf
Setting server root directory to '{{ env "APP_ROOT" }}/dist'
Setting server location path to '/'
Reusing cached layer /layers/paketo-buildpacks_nginx/nginx
Timer: Builder ran for 2m23.572470167s and ended at 2023-10-31T04:08:48Z
Reusing cache again, check result (different args and app root):
Keep same working dir. , we can custom build directories by set GIT_CLONE_PATH=/workspace. (We cant: the GIT_CLONE_PATH="/workspace" has to be within "/builds")
From pack CLI side: pack build --workspace=/builds/group/project.
From GitLab CI side: move $CI_PROJECT_DIR/* to /workspace first, but it is ugly.
Even no this problem, we should keep same directory layout in app image.
Expected Behavior
We use pack CLI and GitLab CI to build same image, but the default working dir of pack CLI is
/workspace
and in GitLab CI is/builds/group/project
. If we use two methods together, the image should not run error.Current Behavior
We create a Vue demo with env
BP_WEB_SERVER=nginx
, but when we run this image we got error:From run.go, we think that
tempDir
replacement is missed before nginx start. But why this happened? We check the image content:the nginx args is
/workspace
but app root is/builds/k8s/buildpacks-vue-demo
, they shoule be the same.Steps to Reproduce
Paketo Buildpack for Nginx Server 0.15.6 and more versions see the followed scripts.
.gitlab-ci.yml
pack command:
(env set in project.toml)
check script:
1. Fresh build in GitLab CI, no previouse image
Job log:
Check result (same args and app root):
2. Pack build with local previouse image by GitLab CI
Command output:
Compare to step 1, there are no "Configuring launch environment" and other jobs, just "Reusing cached layer".
docker push gitlab-registry.example.com/k8s/buildpacks-vue-demo
then check, see the result in above "Current Behavior".3. Pack build after delete local and remote images
Command output:
No "Reusing cached layer" but "Configuring launch environment", same as step 1, docker push then check (same args and app root):
4. GitLab CI with previouse image by pack CLI
Job log:
Reusing cache again, check result (different args and app root):
Possible Solution
, we can custom build directories by set(We cant:GIT_CLONE_PATH=/workspace
.the GIT_CLONE_PATH="/workspace" has to be within "/builds"
)pack build --workspace=/builds/group/project
.$CI_PROJECT_DIR/*
to/workspace
first, but it is ugly.and in run.go:
this slient fail is why
client_body_temp_path
error but not nginx.conf 404?The text was updated successfully, but these errors were encountered: