Merge pull request #2301 from dokku/2300_mh-allow-appjson-in-workdir
fix app.json extraction in dockerfile apps not using /app
This commit is contained in:
@@ -13,7 +13,8 @@ Common use cases include:
|
|||||||
|
|
||||||
Dokku accomplishes this by using an `app.json` file. The format in use is similar to format of Heroku's [app.json](https://devcenter.heroku.com/articles/app-json-schema).
|
Dokku accomplishes this by using an `app.json` file. The format in use is similar to format of Heroku's [app.json](https://devcenter.heroku.com/articles/app-json-schema).
|
||||||
However, dokku currently only supports the nodes `scripts.dokku.predeploy` and `scripts.dokku.postdeploy`.
|
However, dokku currently only supports the nodes `scripts.dokku.predeploy` and `scripts.dokku.postdeploy`.
|
||||||
Simply place an `app.json` file in the root of your repository or for dockerfile apps, `ADD` it to /app.
|
For buildpack apps, simply place an `app.json` file in the root of your repository.
|
||||||
|
For dockerfile apps, place `app.json` in the configured `WORKDIR` directory; otherwise dokku defaults to the buildpack app behavior of looking in `/app`.
|
||||||
>NOTE: postdeploy changes are *NOT* committed to the app image.
|
>NOTE: postdeploy changes are *NOT* committed to the app image.
|
||||||
|
|
||||||
### Example app.json
|
### Example app.json
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ get_phase_script() {
|
|||||||
local APP_JSON_FILE="$GET_PHASE_SCRIPT_TMP_WORK_DIR/app.json"
|
local APP_JSON_FILE="$GET_PHASE_SCRIPT_TMP_WORK_DIR/app.json"
|
||||||
trap 'rm -rf "$GET_PHASE_SCRIPT_TMP_WORK_DIR" > /dev/null' RETURN INT TERM
|
trap 'rm -rf "$GET_PHASE_SCRIPT_TMP_WORK_DIR" > /dev/null' RETURN INT TERM
|
||||||
|
|
||||||
copy_from_image "$IMAGE" "/app/app.json" "$GET_PHASE_SCRIPT_TMP_WORK_DIR" 2>/dev/null || true
|
copy_from_image "$IMAGE" "app.json" "$GET_PHASE_SCRIPT_TMP_WORK_DIR" 2>/dev/null || true
|
||||||
|
|
||||||
if [[ -f "$APP_JSON_FILE" ]];then
|
if [[ -f "$APP_JSON_FILE" ]];then
|
||||||
local VALUE=$(get_json_value "scripts.dokku.${PHASE_SCRIPT_KEY}" < "$APP_JSON_FILE")
|
local VALUE=$(get_json_value "scripts.dokku.${PHASE_SCRIPT_KEY}" < "$APP_JSON_FILE")
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ EXPOSE 3001/udp
|
|||||||
EXPOSE 3000/tcp
|
EXPOSE 3000/tcp
|
||||||
EXPOSE 3003
|
EXPOSE 3003
|
||||||
|
|
||||||
COPY . /app
|
COPY . /var/www/html
|
||||||
WORKDIR /app
|
WORKDIR /var/www/html
|
||||||
RUN npm install
|
RUN npm install
|
||||||
|
|
||||||
CMD npm start
|
CMD npm start
|
||||||
|
|||||||
@@ -11,8 +11,8 @@
|
|||||||
"logo": "https://raw.githubusercontent.com/dokku/dokku/master/docs/assets/dokku.png",
|
"logo": "https://raw.githubusercontent.com/dokku/dokku/master/docs/assets/dokku.png",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dokku": {
|
"dokku": {
|
||||||
"predeploy": "touch /app/predeploy.test",
|
"predeploy": "mkdir -p /app && touch /app/predeploy.test",
|
||||||
"postdeploy": "touch /app/postdeploy.test"
|
"postdeploy": "mkdir -p /app && touch /app/postdeploy.test"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"env": {
|
"env": {
|
||||||
|
|||||||
Reference in New Issue
Block a user