Skip to content

Commit 41598d0

Browse files
Merge pull request UltimaHoarder#1504 from DIGITALCRIMINAL/revert-1491-master
Revert "Improving Docker to multi-stage building."
2 parents ff293b0 + 91f209d commit 41598d0

File tree

2 files changed

+7
-65
lines changed

2 files changed

+7
-65
lines changed

.dockerignore

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,5 @@
1+
.git
12
.logs
23
.settings
34
.sites
4-
__pycache__
5-
6-
# Docker
7-
Dockerfile
8-
.dockerignore
9-
10-
# Git
11-
.git
12-
.gitignore
13-
14-
# License
15-
LICENSE
16-
17-
# PyCharm
18-
.idea
19-
20-
# Readme
21-
*.md
22-
23-
# Virtual Environment
24-
/venv/
5+
__pycache__

Dockerfile

Lines changed: 5 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,10 @@
1-
# Sets python:latest as the builder.
2-
FROM python:latest as builder
1+
FROM python:3-slim
32

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
104

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
157

16-
# Sets python:slim as the release image.
17-
FROM python:slim as release
8+
COPY . .
189

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.
4910
CMD [ "python", "./start_ofd.py" ]

0 commit comments

Comments
 (0)