refactor: fix handling of string andd array CMD and ENTRYPOINT values
Previous versions extracted the values as strings, prefixing the values with `/bin/sh -c '$CMD'` unnecessarily. This caused issues where we would incorrectly overrride these values when an app had a predeploy script. Closes #3143
This commit is contained in:
10
tests/apps/dockerfile-entrypoint/Dockerfile
Normal file
10
tests/apps/dockerfile-entrypoint/Dockerfile
Normal file
@@ -0,0 +1,10 @@
|
||||
FROM ruby:2.5.1
|
||||
|
||||
RUN mkdir /app
|
||||
WORKDIR /app
|
||||
|
||||
ADD Procfile Procfile
|
||||
ADD entrypoint entrypoint
|
||||
ADD app.json app.json
|
||||
|
||||
ENTRYPOINT ["./entrypoint"]
|
||||
1
tests/apps/dockerfile-entrypoint/Procfile
Normal file
1
tests/apps/dockerfile-entrypoint/Procfile
Normal file
@@ -0,0 +1 @@
|
||||
web: sleep 1000
|
||||
7
tests/apps/dockerfile-entrypoint/app.json
Normal file
7
tests/apps/dockerfile-entrypoint/app.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"scripts": {
|
||||
"dokku": {
|
||||
"predeploy": "touch /app/predeploy.test"
|
||||
}
|
||||
}
|
||||
}
|
||||
4
tests/apps/dockerfile-entrypoint/entrypoint
Executable file
4
tests/apps/dockerfile-entrypoint/entrypoint
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "entrypoint script started with arguments $@"
|
||||
exec "$@"
|
||||
8
tests/apps/dockerfile-procfile/app.json
Normal file
8
tests/apps/dockerfile-procfile/app.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"scripts": {
|
||||
"dokku": {
|
||||
"predeploy": "touch /app/predeploy.test",
|
||||
"postdeploy": "touch /app/postdeploy.test"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,12 @@ teardown() {
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run docker inspect "${TEST_APP}.web.1" --format "{{json .Config.Cmd}}"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output '["/start","web"]'
|
||||
|
||||
run /bin/bash -c "dokku --rm run $TEST_APP ls /app/prebuild.test"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
@@ -37,10 +43,47 @@ teardown() {
|
||||
assert_success
|
||||
}
|
||||
|
||||
|
||||
@test "(app-json) app.json scripts missing" {
|
||||
deploy_app nodejs-express-noappjson
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "(app-json) app.json dockerfile cmd" {
|
||||
deploy_app dockerfile-procfile
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run docker inspect "dokku/${TEST_APP}:latest" --format "{{json .Config.Cmd}}"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output '["/bin/sh","-c","npm start"]'
|
||||
|
||||
run docker inspect "dokku/${TEST_APP}:latest" --format "{{json .Config.Entrypoint}}"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output 'null'
|
||||
}
|
||||
|
||||
@test "(app-json) app.json dockerfile entrypoint" {
|
||||
deploy_app dockerfile-entrypoint
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run docker inspect "dokku/${TEST_APP}:latest" --format "{{json .Config.Cmd}}"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output 'null'
|
||||
|
||||
run docker inspect "dokku/${TEST_APP}:latest" --format "{{json .Config.Entrypoint}}"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output '["./entrypoint"]'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user