I have a docker compose file which sets up a service with a GitHub URL for the context. The service’s Dockerfile copies a requirements.txt
and installs it. That works OK (COPY requirements.txt /rasa_traind/
). But when I change that line to COPY . <dir>
I get a COPY failed: file not found in build context
error.
Docker Compose
chatbot_server:
build:
context: <GitHub URL>
dockerfile: Dockerfile
ports:
- "5005:5005"
depends_on:
- rasa_actions_server
- redis
extra_hosts:
- "host.docker.internal:host-gateway" # for docker.host.internal to work on Linux
docker-compose build
Step 4/8 : RUN pip install --upgrade pip
---> Using cache
---> 5a584d36ea77
Step 5/8 : COPY . /rasa_traind/
ERROR: Service 'chatbot_server' failed to build: COPY failed: file not found in build context or excluded by .dockerignore: stat rasa_traind/: file does not exist
Dockerfile
FROM python:3.8.12-slim-buster
RUN apt-get update
RUN yes | apt-get install python3-dev build-essential
RUN pip install --upgrade pip
# COPY requirements.txt /rasa_traind/ # Works
COPY . /rasa_traind/
RUN pip install -r requirements.txt
WORKDIR /rasa_traind/rasa_actions_server/
CMD ["rasa", "run"]