Giter VIP home page Giter VIP logo

Comments (9)

dmathieu avatar dmathieu commented on September 5, 2024

Simon,

What happens if you do docker build .?
This CLI tool is "only" a wrapper around the docker CLI. So if COPY doesn't work, it's probably a local issue rather than with it.

Thanks

from heroku-container-registry.

simonfromla avatar simonfromla commented on September 5, 2024

docker build . returns unable to prepare context: unable to evaluate symlinks in Dockerfile path: lstat /Users/sju/Dev/django/django-docker-1/luup/Dockerfile: no such file or directory

from heroku-container-registry.

dmathieu avatar dmathieu commented on September 5, 2024

You have to specify the dockerfile name if it's not Dockerfile

from heroku-container-registry.

simonfromla avatar simonfromla commented on September 5, 2024

Specifying the path to the Dockerfile, I'm able to build all of them individually.

For example, docker build -f compose/production/postgres/Dockerfile.postgres . will complete COPY and all the Dockerfile instructions.

Following, if the heroku CLI is a wrapper around the docker CLI, do I similarly provide context in the command heroku:container push processA processB processC --recursive so that COPY doesn't fail? If so, I'm unable to find any documentation regarding it

from heroku-container-registry.

dmathieu avatar dmathieu commented on September 5, 2024

The docker build you're doing is indeed similar to what we do.
You can see it here.

Could you give us the full output you're getting from docker, including the exact command you're typing, and the content of your Dockerfile?

from heroku-container-registry.

simonfromla avatar simonfromla commented on September 5, 2024

The command I'm attempting: heroku container:push django caddy postgres --recursive
The output of the command:

=== Building django (/Users/sju/Dev/django/django-docker-1/luup/compose/production/django/Dockerfile.django)
Sending build context to Docker daemon  9.216kB
Step 1/26 : FROM python:3.6-alpine
 ---> c3a4a35c9244
Step 2/26 : ENV PYTHONUNBUFFERED 1
 ---> Using cache
 ---> 73473a868596
Step 3/26 : RUN apk update   && apk add --virtual build-deps gcc python3-dev musl-dev   && apk add postgresql-dev   && apk add jpeg-dev zlib-dev freetype-dev lcms2-dev openjpeg-dev tiff-dev tk-dev tcl-dev   && apk add libffi-dev openssl-dev py-cffi
 ---> Using cache
 ---> 836535f4c88d
Step 4/26 : RUN addgroup -S django     && adduser -S -G django django
 ---> Using cache
 ---> 16e570f295a7
Step 5/26 : COPY ./requirements /requirements
COPY failed: stat /var/lib/docker/tmp/docker-builder212589504/requirements: no such file or directory
 ▸    Error: docker build exited with 1

The contents of Dockerfile.django:

FROM python:3.6-alpine
ENV PYTHONUNBUFFERED 1
RUN apk update \
  # psycopg2 dependencies
  && apk add --virtual build-deps gcc python3-dev musl-dev \
  && apk add postgresql-dev \
  # Pillow dependencies
  && apk add jpeg-dev zlib-dev freetype-dev lcms2-dev openjpeg-dev tiff-dev tk-dev tcl-dev \
  # CFFI dependencies
  && apk add libffi-dev openssl-dev py-cffi
RUN addgroup -S django \
    && adduser -S -G django django
# Requirements have to be pulled and installed here, otherwise caching won't work
COPY ./requirements /requirements
RUN pip install --no-cache-dir -r /requirements/production.txt \
    && rm -rf /requirements
COPY ./compose/production/django/gunicorn.sh /gunicorn.sh
RUN sed -i 's/\r//' /gunicorn.sh
RUN chmod +x /gunicorn.sh
RUN chown django /gunicorn.sh
COPY ./compose/production/django/entrypoint.sh /entrypoint.sh
RUN sed -i 's/\r//' /entrypoint.sh
RUN chmod +x /entrypoint.sh
RUN chown django /entrypoint.sh
COPY ./compose/production/django/celery/worker/start.sh /start-celeryworker.sh
RUN sed -i 's/\r//' /start-celeryworker.sh
RUN chmod +x /start-celeryworker.sh
COPY ./compose/production/django/celery/beat/start.sh /start-celerybeat.sh
RUN sed -i 's/\r//' /start-celerybeat.sh
RUN chmod +x /start-celerybeat.sh
COPY . /app
RUN chown -R django /app
USER django
WORKDIR /app
ENTRYPOINT ["/entrypoint.sh"]
CMD gunicorn config.wsgi:application --bind=0:$PORT --access-logfile=- --error-logfile=-  

I also have Dockerfile.caddy and Dockerfile.postgres--without a CMD instruction as I'm unsure what needs to be put here(although they are required from what I read):

FROM abiosoft/caddy:0.10.6
COPY ./compose/production/caddy/Caddyfile /etc/Caddyfile
FROM postgres:10.1

COPY ./compose/production/postgres/maintenance /usr/local/bin/maintenance
RUN chmod +x /usr/local/bin/maintenance/*
RUN mv /usr/local/bin/maintenance/* /usr/local/bin \
    && rmdir /usr/local/bin/maintenance

tree structure from project root:

├── Procfile
├── README.rst
├── compose
│   ├── local
│   │   └── django
│   │       ├── Dockerfile.local
│   │       ├── celery
│   │       │   ├── beat
│   │       │   │   └── start.sh
│   │       │   └── worker
│   │       │       └── start.sh
│   │       └── start.sh
│   └── production
│       ├── caddy
│       │   ├── Caddyfile
│       │   └── Dockerfile.caddy
│       ├── django
│       │   ├── Dockerfile.django
│       │   ├── celery
│       │   │   ├── beat
│       │   │   │   └── start.sh
│       │   │   └── worker
│       │   │       └── start.sh
│       │   ├── entrypoint.sh
│       │   └── gunicorn.sh
│       └── postgres
│           ├── Dockerfile.postgres

from heroku-container-registry.

dmathieu avatar dmathieu commented on September 5, 2024

I see no requirements file in that project tree.
Also, the docker build you've done earlier isn't on the same Dockerfile. You previously did Dockerfile.postgres, but it now fails on Dockerfile.django.

from heroku-container-registry.

simonfromla avatar simonfromla commented on September 5, 2024

Apologies for mixing up the example--they fail regardless of which Dockerfile I'm using. I also trimmed the tree due to size but here it is including the requirements(near the bottom):

├── Procfile
├── README.rst
├── compose
│   ├── local
│   │   └── django
│   │       ├── Dockerfile.local
│   │       ├── celery
│   │       │   ├── beat
│   │       │   │   └── start.sh
│   │       │   └── worker
│   │       │       └── start.sh
│   │       └── start.sh
│   └── production
│       ├── caddy
│       │   ├── Caddyfile
│       │   └── Dockerfile.caddy
│       ├── django
│       │   ├── Dockerfile.django
│       │   ├── celery
│       │   │   ├── beat
│       │   │   │   └── start.sh
│       │   │   └── worker
│       │   │       └── start.sh
│       │   ├── entrypoint.sh
│       │   └── gunicorn.sh
│       └── postgres
│           ├── Dockerfile.postgres
│           └── maintenance
│               ├── _sourced
│               │   ├── constants.sh
│               │   ├── countdown.sh
│               │   ├── messages.sh
│               │   └── yes_no.sh
│               ├── backup
│               ├── backups
│               └── restore
├── config
│   ├── __init__.py
│   ├── __pycache__
│   │   ├── __init__.cpython-36.pyc
│   │   ├── urls.cpython-36.pyc
│   │   └── wsgi.cpython-36.pyc
│   ├── settings
│   │   ├── __init__.py
│   │   ├── __pycache__
│   │   │   ├── __init__.cpython-36.pyc
│   │   │   ├── base.cpython-36.pyc
│   │   │   ├── local.cpython-36.pyc
│   │   │   └── production.cpython-36.pyc
│   │   ├── base.py
│   │   ├── local.py
│   │   ├── production.py
│   │   └── test.py
│   ├── urls.py
│   └── wsgi.py
├── docs
│   ├── Makefile
│   ├── __init__.py
│   ├── conf.py
│   ├── deploy.rst
│   ├── docker_ec2.rst
│   ├── index.rst
│   ├── install.rst
│   └── make.bat
├── local.yml
├── locale
│   └── README.rst
├── lurnup
│   ├── __init__.py
│   ├── __pycache__
│   │   └── __init__.cpython-36.pyc
│   ├── contrib
│   │   ├── __init__.py
│   │   ├── __pycache__
│   │   │   └── __init__.cpython-36.pyc
│   │   └── sites
│   │       ├── __init__.py
│   │       ├── __pycache__
│   │       │   └── __init__.cpython-36.pyc
│   │       └── migrations
│   │           ├── 0001_initial.py
│   │           ├── 0002_alter_domain_unique.py
│   │           ├── 0003_set_site_domain_and_name.py
│   │           ├── __init__.py
│   │           └── __pycache__
│   │               ├── 0001_initial.cpython-36.pyc
│   │               ├── 0002_alter_domain_unique.cpython-36.pyc
│   │               ├── 0003_set_site_domain_and_name.cpython-36.pyc
│   │               └── __init__.cpython-36.pyc
│   ├── static
│   │   ├── css
│   │   │   └── project.css
│   │   ├── fonts
│   │   ├── images
│   │   │   └── favicon.ico
│   │   ├── js
│   │   │   └── project.js
│   │   └── sass
│   │       ├── custom_bootstrap_vars.scss
│   │       └── project.scss
│   ├── taskapp
│   │   ├── __init__.py
│   │   ├── __pycache__
│   │   │   ├── __init__.cpython-36.pyc
│   │   │   └── celery.cpython-36.pyc
│   │   └── celery.py
│   ├── templates
│   │   ├── 403_csrf.html
│   │   ├── 404.html
│   │   ├── 500.html
│   │   ├── account
│   │   │   ├── account_inactive.html
│   │   │   ├── base.html
│   │   │   ├── email.html
│   │   │   ├── email_confirm.html
│   │   │   ├── login.html
│   │   │   ├── logout.html
│   │   │   ├── password_change.html
│   │   │   ├── password_reset.html
│   │   │   ├── password_reset_done.html
│   │   │   ├── password_reset_from_key.html
│   │   │   ├── password_reset_from_key_done.html
│   │   │   ├── password_set.html
│   │   │   ├── signup.html
│   │   │   ├── signup_closed.html
│   │   │   ├── verification_sent.html
│   │   │   └── verified_email_required.html
│   │   ├── base.html
│   │   ├── pages
│   │   │   ├── about.html
│   │   │   └── home.html
│   │   └── users
│   │       ├── user_detail.html
│   │       ├── user_form.html
│   │       └── user_list.html
│   └── users
│       ├── __init__.py
│       ├── __pycache__
│       │   ├── __init__.cpython-36.pyc
│       │   ├── admin.cpython-36.pyc
│       │   ├── apps.cpython-36.pyc
│       │   ├── models.cpython-36.pyc
│       │   ├── urls.cpython-36.pyc
│       │   └── views.cpython-36.pyc
│       ├── adapters.py
│       ├── admin.py
│       ├── apps.py
│       ├── migrations
│       │   ├── 0001_initial.py
│       │   ├── __init__.py
│       │   └── __pycache__
│       │       ├── 0001_initial.cpython-36.pyc
│       │       └── __init__.cpython-36.pyc
│       ├── models.py
│       ├── tests
│       │   ├── __init__.py
│       │   ├── factories.py
│       │   ├── test_admin.py
│       │   ├── test_models.py
│       │   ├── test_urls.py
│       │   └── test_views.py
│       ├── urls.py
│       └── views.py
├── manage.py
├── merge_production_dotenvs_in_dotenv.py
├── production.yml
├── pytest.ini
├── requirements
│   ├── base.txt
│   ├── local.txt
│   └── production.txt
├── setup.cfg
└── utility
    ├── install_os_dependencies.sh
    ├── install_python_dependencies.sh
    ├── requirements-jessie.apt
    ├── requirements-stretch.apt
    ├── requirements-trusty.apt
    └── requirements-xenial.apt  

from heroku-container-registry.

dmathieu avatar dmathieu commented on September 5, 2024

Well, the requirements folder needs to be in the same folder as your Dockerfile.
The reason this is failing is because you're not using the same folder we're using. You do:

docker build -t subfolder/Dockerfile.django .

When we build with the same folder as the Dockerfile as context. So we actually run:

docker build -t subfolder/Dockerfile.django subfolder/

This is not an issue with this plugin.

from heroku-container-registry.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.