|
1 | | -# Sets python:latest as the builder. |
2 | | -FROM python:latest as builder |
| 1 | +FROM python:3-slim |
3 | 2 |
|
4 | | -# Updates and installs required Linux dependencies. |
5 | | -RUN set -eux \ |
6 | | - && apt-get -y update \ |
7 | | - && apt-get -y upgrade \ |
8 | | - && apt-get clean \ |
9 | | - && rm -rf /var/lib/apt/lists/* |
| 3 | +WORKDIR /usr/src/app |
10 | 4 |
|
11 | | -# Installs required Python dependencies. |
12 | | -COPY requirements.txt /onlyfans/ |
13 | | -WORKDIR /onlyfans |
14 | | -RUN pip install -r requirements.txt |
| 5 | +COPY requirements.txt ./ |
| 6 | +RUN pip install --no-cache-dir -r requirements.txt |
15 | 7 |
|
16 | | -# Sets python:slim as the release image. |
17 | | -FROM python:slim as release |
| 8 | +COPY . . |
18 | 9 |
|
19 | | -# Defines new group and user for security reasons. |
20 | | -RUN groupadd -r onlyfans \ |
21 | | - && useradd -r -g onlyfans onlyfans |
22 | | - |
23 | | -# Updates and installs required Linux dependencies. |
24 | | -RUN set -eux \ |
25 | | - && apt-get -y update \ |
26 | | - && apt-get -y upgrade \ |
27 | | - && apt-get install -y \ |
28 | | - libpq-dev \ |
29 | | - vim \ |
30 | | - \ |
31 | | - && apt-get clean \ |
32 | | - && rm -rf /var/lib/apt/lists/* |
33 | | - |
34 | | -# Copies Linux binaries, and Python packages from the main builder. |
35 | | -COPY --from=builder /usr/local/bin/ /usr/local/bin/ |
36 | | -COPY --from=builder /usr/local/lib/python3.9/site-packages/ /usr/local/lib/python3.9/site-packages/ |
37 | | - |
38 | | -# Copies the source code from the host into the container. |
39 | | -COPY --chown=onlyfans:onlyfans . /onlyfans |
40 | | -WORKDIR /onlyfans |
41 | | - |
42 | | -# Ensures that Python output will be sent to the terminal. |
43 | | -ENV PYTHONUNBUFFERED 1 |
44 | | - |
45 | | -# Changes to the new user for security reasons. |
46 | | -USER onlyfans |
47 | | - |
48 | | -# Specifies the main executable for when the container starts. |
49 | 10 | CMD [ "python", "./start_ofd.py" ] |
0 commit comments