forked from Oly-fashion/fastapi-auth-web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
44 lines (33 loc) · 1.19 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
FROM python:3.11-slim
# Set work directory
WORKDIR /usr/src/app
# Install lib dependencies
RUN apt-get update \
&& apt-get -y install libpq-dev gcc postgresql-client jq
# Install Poetry
RUN pip install poetry
# Copy the Poetry configuration files into the container
COPY pyproject.toml poetry.lock* /usr/src/app/
# Copy the project files into the container
COPY . /usr/src/app/
# Remove the tests directory
RUN rm -rf /usr/src/app/tests
# Remove all docs
RUN rm -rf /usr/src/app/docs
# Setup Shmig to run migrations
RUN cp /usr/src/app/scripts/shmig/shmig /usr/local/bin/shmig \
&& chmod +x /usr/local/bin/shmig
# Install the project dependencies
RUN poetry config virtualenvs.create false \
&& poetry install --no-interaction --no-ansi --without dev
EXPOSE 8989
# Command to run the Uvicorn server
# specify env by passing a value for ENV in the environment variable
# e.g. docker run -e ENV=dev imagename
#
# Use CMD to specify the command to run when the container starts.
# Supported values are migrate, weave, and serve.
# `serve` and `weave` cannot be called at the same time.
# e.g. python ./scripts/start.py migrate serve
ENTRYPOINT ["python", "./scripts/start.py"]
CMD ["migrate", "serve"]