-
Notifications
You must be signed in to change notification settings - Fork 792
[BUG] kompose dont respect target of compose build #1839
Description
Expected Behavior
Kompose when used with kompose convert --build=local -v -o kubernetes/local should follow the build command in the docker compose with it relative target and context.
Actual Behavior
Kompose build a image up until the last line in the dockerfile, missing what is configured in the docker compose configuration file.
Steps To Reproduce
- make a multilayer mutistep dockerfile.
- make a docker compose tha build and uses only a subset of that
context: .
target: development-backend
- launch
kompose convert --build=local -v
Kompose Version
1.32.0 (HEAD)
Docker-Compose file
secrets:
github_token:
file: .github_token
networks:
internal:
company:
name: company
services:
app:
# TODO: rename
container_name: company-core-dev
command: serve-backend
build:
context: .
target: development-backend
secrets:
- github_token
env_file:
- .env.local
stop_grace_period: 0s
healthcheck:
test: ["CMD", "curl", "-f", "http://core.company.local/"]
interval: 30s
timeout: 10s
retries: 20
start_period: 30s
user: ${RUN_UID}:${RUN_GID}
depends_on:
db:
condition: service_healthy
redis:
condition: service_started
volumes:
- ./:/app
networks:
- internal
- company
frontend:
command: serve-frontend
build:
context: .
target: development-frontend
env_file:
- .env.local
stop_grace_period: 0s
user: node:node
volumes:
- ./:/app
depends_on:
app:
condition: service_started
networks:
- internal
- company
caddy:
container_name: company-core-caddy
build:
context: .
target: caddy
volumes:
- ./docker/configs/Caddyfile:/app/Caddyfile
env_file:
- .env.local
stop_grace_period: 0s
depends_on:
- app
networks:
- company
- internal
profiles:
- productionAnything else?
the last layer of the image is caddy, but in the APP deployment on minikube (thats where i am testing) i receive this error:
app-78f55f74c7-x6nh2 company-core-dev Error: unknown command "serve-backend" for "caddy"
app-78f55f74c7-x6nh2 company-core-dev Run 'caddy --help' for usage.
this means that the target is not followed and the image si build to the end of the dockerfile.
I would also suggest that in order to work when you build local image and dont push, you need to add the
imagePullPolicy: Never
to every single manifest, can this be added by default or by a trigger when running the cli in some way?