datawire / forge

Define and run multi-container apps in Kubernetes
http://forge.sh
Apache License 2.0
415 stars 43 forks source link

Using docker image namespace with incremental build #225

Closed dlaidlaw closed 6 months ago

dlaidlaw commented 5 years ago

If you set an image name in the service.yaml that contains a namespace, then incremental builds fail because the incremental build attempts to run the generated image using a name that is created from the image name with namespace. The image name with namespace will have a '/' character in the name, which is invalid as a docker container name.

For example:

name: demo-user   # Demo user service

containers:
  - dockerfile: Dockerfile
    name: dma/demo-user
    rebuild:
      # Where our code lives inside the container.
      root: /app
      # The command used to rebuild our code inside the container.
      command: ./gradlew build
      # A list of input sources that get synced into the container prior to builds.
      sources:
      - build.gradle
      - settings.gradle
      - src

profiles:
  default:
    maxMemory: '320Mi'
    maxCpu: '0.5'
    memory: '256Mi'
    cpu: '0.2'

branch:
  '*': default

In the code above, the image name is set to dma/demo-user, where dma is the image namespace. Using the incremental build, forge attempts to run the generated image using: docker run --rm --name forge_dma/demo-user_bigshastringhere. The slash (/) is invalid in a container name.

Forge should replace the slashes in the name with underscores or dashes or dots (_, -, .) which are legal characters in the name.

dlaidlaw commented 6 months ago

No point in keeping this open after more than 5 years.