okteto / okteto

Develop your applications directly in your Kubernetes Cluster
https://okteto.com
Apache License 2.0
3.27k stars 316 forks source link

Error building: file with no instructions? #3218

Closed scheung38 closed 1 year ago

scheung38 commented 2 years ago

*Describe the bug** A clear and concise description of what the bug is.

Error building service ‘django’: error building image ‘sample_cookiecutter_local_django’: build failed: failed to solve: file with no instructions?

To Reproduce Steps to reproduce the behavior:

okteto deploy --build --wait

okteto.yml

build:
  django:
    image: sample_cookiecutter_local_django
    context: .
deploy:
  - kubectl apply -f manifest

production.yml

version: '3'

volumes:
  production_postgres_data: {}
  production_postgres_data_backups: {}
  production_traefik: {}

services:
  django:
    build:
      context: .
      dockerfile: ./compose/production/django/Dockerfile
    image: sample_cookiecutter_production_django
    depends_on:
      - postgres
    env_file:
      - ./.envs/.production/.django
      - ./.envs/.production/.postgres
    command: /start
    ports:
      - "8000:8000"

  postgres:
    build:
      context: .
      dockerfile: ./compose/production/postgres/Dockerfile
    image: sample_cookiecutter_production_postgres
    volumes:
      - production_postgres_data:/var/lib/postgresql/data:Z
      - production_postgres_data_backups:/backups:z
    env_file:
      - ./.envs/.production/.postgres
    ports:
      - 5432:5432

  traefik:
    build:
      context: .
      dockerfile: ./compose/production/traefik/Dockerfile
    image: sample_cookiecutter_production_traefik
    depends_on:
      - django
    volumes:
      - production_traefik:/etc/traefik/acme:z
    ports:
      - "0.0.0.0:80:80"
      - "0.0.0.0:443:443"

where manifest is folder that was created from

kompose --file production.yml -o $HOME/Documents/sample_cookiecutter/manifest convert --volumes hostPath

Expected behavior okteto cloud deploy of django app

Desktop (please complete the following information):

jLopezbarb commented 1 year ago

Hi @scheung38, can you provide the Dockerfile that is in .. You are using that one in the okteto.yml.

Another thing is that the docker compose is not referenced in the okteto.yml. How to deploy a compose from an okteto manifest can be found here, but if you are just going to deploy a compose file, you can directly deploy and build by using the --file flag

scheung38 commented 1 year ago

Thanks @jLopezbarb when can hot reload work and when can it not work without a full okteto deploy --build?

For example, ie changing the content of docker-compose-production.yml, I don't expect ok up to hot reload to work without a full okteto deploy --build?

jLopezbarb commented 1 year ago

hot reloading is intended when you develop on the code of the service deployed, but not for the intra configuration (db/traeffik).

What I usually do when I have to develop a new feature/fix a bug is to first deploy the latest changes by running okteto deploy --build and then start coding on the services that I need to using okteto up. I don't usually run okteto deploy --build again until I start another issue. Only run okteto deploy --build whenever you want to redeploy the full application (okteto deploy --build svc to redeploy just the service specified) but use okteto up if you are still coding on one of the services and need to add more changes on that service. Hope it helps

github-actions[bot] commented 1 year ago

This issue is stale because it has been open for 60 days with no activity. Comment on this issue or it will be closed in 7 days