Hello, i got problem with mounting volumes. I dont get how it works. In my previous project i didnt have any problem.
I want to create small fastapi app, but cant to mount my project folder to cointainer. Could someone help me to solve this problem? I was digging a lot on google, but nothing helped me.
Here is my Dockerfile:
FROM python:3.10-alpine as development
EXPOSE 8000
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
COPY ./requirements.txt /requirements.txt
RUN pip install --no-cache-dir --upgrade -r /requirements.txt
RUN mkdir /fastapi_app
WORKDIR /fastapi_app
COPY . /fastapi_app
RUN adduser -u 5678 --disabled-password --gecos "" user && chown -R user /fastapi_app
USER user
CMD ["uvicorn", "app:app", "--reload", "--host", "0.0.0.0", "--port", "8000"]
docker-compose:
version: '3.8'
services:
fastappi:
build:
context: .
target: development
ports:
- "8000:8000"
volumes:
- .:/fastapi_app
command: >
sh -c "ls -la && ls && pwd && uvicorn app:app --host 0.0.0.0 --reload"
restart: always
After writing docker-compose up im getting error, becouse folder fastapi_app is empty: