-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Dockerfile
57 lines (42 loc) · 1.48 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
45
46
47
48
49
50
51
52
53
54
55
56
57
################
## Base stage ##
################
FROM python:3.10-slim AS base
# Set the working directory for the application
WORKDIR /app
# Set PYTHONUNBUFFERED to ensure immediate output
# for print statements and avoid output buffering.
ENV PYTHONUNBUFFERED 1
COPY pyproject.toml package.json package-lock.json ./
RUN pip install --no-cache-dir poetry \
&& poetry config virtualenvs.create false \
&& poetry install --without dev --no-interaction --no-ansi
#######################
## Development stage ##
#######################
FROM base AS development
# Install Node.js, Git, and other dependencies
RUN apt-get update && apt-get install -y curl git && \
curl -sL https://deb.nodesource.com/setup_20.x | bash - && \
apt-get install -y nodejs && \
# Clean up APT when done
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
COPY . .
# Install Node.js dependencies
RUN npm install
# Initialize an empty Git repository
# for allowing pre-commit install to run without errors.
RUN git init \
&& poetry install --no-interaction --no-ansi \
&& poetry run pre-commit install
# indicate what port the server is running on
EXPOSE 3000
CMD ["flask", "--app", "chatiq.main:app", "--debug", "run", "--host", "0.0.0.0", "--port", "3000"]
#######################
## Production stage ##
#######################
FROM base AS production
COPY . .
# indicate what port the server is running on
EXPOSE 3000
CMD ["gunicorn", "chatiq.main:app", "--bind", "0.0.0.0:3000"]