-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
47 lines (33 loc) · 1.11 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
# Build phase
FROM python:3.10.10-slim-bullseye AS builder
# Set the working directory
WORKDIR /app
# Install build dependencies
RUN apt-get update && \
apt-get install -y build-essential
# Copy and install the dependencies
COPY pyproject.toml poetry.lock ./
ENV PIP_DEFAULT_TIMEOUT=1000 \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
PIP_NO_CACHE_DIR=1
RUN pip install poetry -i https://pypi.tuna.tsinghua.edu.cn/simple
RUN poetry config virtualenvs.create false && \
poetry install --no-dev --no-interaction --no-ansi --no-root
# Copy the source code
COPY . .
# Build the server
#RUN poetry build -f wheel && \
# pip install dist/*.whl
# Runtime phase
FROM python:3.10.10-slim-bullseye
# Set the working directory
WORKDIR /app
# Copy the server binary and its dependencies from the builder image
COPY --from=builder /usr/local/lib/python3.10/site-packages /usr/local/lib/python3.10/site-packages
COPY --from=builder /app /app
# Expose the port that the server will listen on
# EXPOSE 50051
# Start the server
CMD cd /app && \
PYTHONPATH=$PYTHONPATH:. \
python emotext/httpapi.py --host 0.0.0.0 --port 9003