Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,7 @@ venv.bak/
dmypy.json

# node
node_modules/
node_modules/

# pdm
.pdm-python
43 changes: 32 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
FROM debian:trixie-slim AS builder
ARG PYTHON_BASE=3.12-slim-bookworm

FROM python:$PYTHON_BASE AS builder

# Repository information is needed for dynamic versioning
#COPY .git/ /app/.git/ # FIXME Problems copying ~/.git for scm data

# Source
COPY src/ /app/src
COPY pyproject.toml pdm.lock /app/

# Readme is needed to satisfy PyProject
COPY README.md /app/

# Build dummy packages to skip installing them and their dependencies
RUN apt-get update \
Expand All @@ -14,49 +26,58 @@ RUN apt-get update \
&& apt-get purge -y --auto-remove equivs \
&& rm -rf /var/lib/apt/lists/*

FROM debian:trixie-slim
WORKDIR /app

# Extract version from git
ARG REL_REF=3.3.21
#RUN REL_REF=$(git describe --tags --abbrev=0) # FIXME Problems copying ~/.git for scm data
RUN echo "Building FlareSolverr version $REL_REF"

# Build package
RUN pip install --upgrade pdm
ENV PDM_UPDATE_CHECK=false
ENV PDM_BUILD_SCM_VERSION=$REL_REF
RUN pdm install --check --prod --no-editable --verbose

FROM python:$PYTHON_BASE

# Copy dummy packages
COPY --from=builder /libgl1-mesa-dri.deb /adwaita-icon-theme.deb /
COPY --from=builder /app/.venv /app/.venv
COPY --from=builder /app/src /app/src

# Install dependencies and create flaresolverr user
WORKDIR /app
COPY requirements.txt .
RUN apt-get update \
# Install dummy packages
&& dpkg -i /libgl1-mesa-dri.deb \
&& dpkg -i /adwaita-icon-theme.deb \
&& apt-get install -f \
# Install dependencies
&& apt-get install -y --no-install-recommends chromium xvfb dumb-init \
procps curl vim xauth python3 python3-pip \
procps curl vim xauth python3 \
# Remove temporary files and hardware decoding libraries
&& rm -rf /var/lib/apt/lists/* \
&& rm -f /usr/lib/x86_64-linux-gnu/libmfxhw* \
&& rm -f /usr/lib/x86_64-linux-gnu/mfx/* \
# Create flaresolverr user
&& useradd --home-dir /app --shell /bin/sh flaresolverr \
&& chown -R flaresolverr:flaresolverr . \
# Set up Python and install dependencies
&& ln -s /usr/bin/python3 /usr/local/bin/python \
&& pip install --break-system-packages -r requirements.txt \
# Remove temporary files
&& rm -rf /root/.cache /tmp/*

USER flaresolverr

RUN mkdir -p "/app/.config/chromium/Crash Reports/pending"

COPY src .
COPY package.json ../

EXPOSE 8191
EXPOSE 8192

# dumb-init avoids zombie chromium processes
ENTRYPOINT ["/usr/bin/dumb-init", "--"]

CMD ["/usr/local/bin/python", "-u", "/app/flaresolverr.py"]
ENV PATH="/app/.venv/bin:$PATH"
CMD ["python", "-um", "flaresolverr"]

# Local build
# docker build -t ngosang/flaresolverr:3.3.21 .
Expand Down
82 changes: 63 additions & 19 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,21 +1,65 @@
MIT License

Files:
*
Copyright (c) 2023 Diego Heras (ngosang / ngosang@hotmail.es)
License: MIT


Files:
src/flaresolverr/DataRecorder/*
Copyright (c) 2021, g1879
License: MIT


Files:
src/flaresolverr/DrissionPage/*
src/flaresolverr/DownloadKit/*
Copyright (c) 2020, g1879
All rights reserved.
License: BSD-3-Clause


License: MIT
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


License: BSD-3-Clause
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Loading