0

This is the Dockerfile:

FROM lambci/lambda:build-python3.6

# Copy in your requirements file
ADD requirements.txt /requirements.txt

# Copy your application code to the container
RUN mkdir /code/
WORKDIR /code/
ADD . /code/

ENV PS1 'zappa@$(pwd | sed "s@^/var/task/\?@@")\$ '

ADD zappa_settings.json /var/task/zappa_settings.json

WORKDIR /var/task

RUN virtualenv /var/venv && \
    source /var/venv/bin/activate && \
    pip install -U pip zappa && \
    pip install -r /requirements.txt && \
    deactivate

CMD ["zappa"]

However, when I run docker-compose up I get:

Recreating basesite_web_1 ...
Recreating basesite_web_1 ... error

ERROR: for basesite_web_1  Cannot start service web: oci runtime error: container_linux.go:262: starting container process caused "exec: \"zappa\": executable file not found in $PATH"


ERROR: for web  Cannot start service web: oci runtime error: container_linux.go:262: starting container process caused "exec: \"zappa\": executable file not found in $PATH"

ERROR: Encountered errors while bringing up the project.

I assume it's because I need to activate the virtualenv. I want to be able to run the project on my local machine for development. What am I missing? Thanks!

BMW
  • 42,880
  • 12
  • 99
  • 116
Diego Jancic
  • 7,280
  • 7
  • 52
  • 80
  • Haven't worked with `zappa` so I'm not sure but have you tried NOT deactivating your virtualenv? – Noel Llevares Oct 04 '17 at 01:55
  • Not sure what your goal here is. If it's to get a development environment with which you'd like to interact with Zappa then check out https://blog.zappa.io/posts/docker-zappa-and-python3 otherwise it is strange to have your CMD as zappa because zappa is generally used as a discreet command to invoke the framework, not to continually run it. – Edgar Oct 04 '17 at 18:40
  • @Edgar, yes, I figured. The `CMD zappa` is wrong, but I want to launch a web server for development. I believe I would need to use a standard Docker image and deploy with zappa without having the environment copied exactly. – Diego Jancic Oct 04 '17 at 19:01
  • I've followed this guide: https://edgarroman.github.io/zappa-django-guide/setup/, but that doesn't explain how to use that image during development, only how to deploy! – Diego Jancic Oct 04 '17 at 19:05

0 Answers0