-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
49 lines (36 loc) · 1.15 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
FROM python:3.10-slim AS base
# Setup env
ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONFAULTHANDLER 1
ENV PATH="/app/.venv/bin:$PATH"
FROM base AS python-deps
# Copy the Pipfile and Pipfile.lock into the container at /app
COPY Pipfile Pipfile.lock /app/
COPY . /app
# Set the working directory to /app
WORKDIR /app
# Copy the pulling_ace directory into the Docker image
COPY pulling_ace /app/pulling_ace
# Install pipenv and compilation dependencies
RUN pip install pipenv && \
apt-get update && apt-get install -y --no-install-recommends gcc && \
apt-get clean && rm -rf /var/lib/apt/lists/*
ENV PYTHON /app
ENTRYPOINT ["python", "-m", "pulling_ace"]
CMD ["cli","10"]
COPY Pipfile.lock .
RUN PIPENV_VENV_IN_PROJECT=1 pipenv install --deploy
FROM base AS runtime
# Copy virtual env from python-deps stage
COPY --from=python-deps /app /app
# Create and switch to a new user
RUN useradd --create-home appuser
WORKDIR /home/appuser
COPY --from=python-deps /app/.venv /home/appuser/.venv
RUN chown -R appuser:appuser /home/appuser/.venv
USER appuser
# Run the executable
ENTRYPOINT ["python", "-m", "pulling_ace"]
CMD ["cli", "10"]