Commit e28797c0 authored by Xavier FRANCOIS's avatar Xavier FRANCOIS Committed by Pierre Smeyers
Browse files

fix: use /workspace dir to avoid unwanted hierarchy in created image

parent bd62e7f7
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -128,8 +128,10 @@ It is bound to the `package-build` stage, and uses the following variables:
It uses the following variable:

| Name            | description                                                                        | default value |
| --------------------- | ---------------------------------------- | ----------------- |
| `CNB_APP_DIR`        | Relative path to the application source code base directory in your repository | `.` |
|-----------------|------------------------------------------------------------------------------------|---------------|
| `CNB_APP_DIR`   | Absolute root directory in final image     | `/workspace`  |
| `CNB_SRC_APP_DIR` | Relative path to the application source code base directory in your repository     | `.`           |


<!--
In addition to the above variables, the CNB template also supports all configuration means supported
+6 −0
Original line number Diff line number Diff line
@@ -11,6 +11,12 @@
    },
    {
      "name": "CNB_APP_DIR",
      "description": "Absolute root directory in final image",
      "default": "/workspace",
      "advanced": true
    },
    {
      "name": "CNB_SRC_APP_DIR",
      "description": "Relative path to the application source code base directory in your repository",
      "default": ".",
      "advanced": true
+7 −2
Original line number Diff line number Diff line
@@ -53,8 +53,11 @@ variables:

  # default CNB platform API version
  CNB_PLATFORM_API: "0.9"
  # default working dir
  CNB_APP_DIR: "."

  # absolute root directory in final image
  CNB_SRC_APP_DIR: "."
  # default final image hierarchy root dir
  CNB_APP_DIR: "/workspace"

  # by default: DevOps pipeline
  PUBLISH_ON_PROD: "true"
@@ -356,6 +359,8 @@ cnb-build:
  script:
    # required to allow Git operations while not owner
    - git config --global --add safe.directory $CI_PROJECT_DIR
    # Copy sources in $CNB_APP_DIR to avoid having the GitLab CI directory structure in the final image
    - cp -r $CI_PROJECT_DIR/$CNB_SRC_APP_DIR/. $CNB_APP_DIR
    - cnb_repository=${CNB_SNAPSHOT_IMAGE%:*}
    - cnb_tag=${CNB_SNAPSHOT_IMAGE##*:}
    # if not set: build cache image from snapshot image