2024-11-25 01:34:59 +03:00
|
|
|
FROM python:slim-bookworm
|
2024-11-17 13:06:37 +03:00
|
|
|
|
|
|
|
ARG G4F_VERSION
|
|
|
|
ARG G4F_USER=g4f
|
|
|
|
ARG G4F_USER_ID=1000
|
|
|
|
|
|
|
|
ENV G4F_VERSION $G4F_VERSION
|
|
|
|
ENV G4F_USER $G4F_USER
|
|
|
|
ENV G4F_USER_ID $G4F_USER_ID
|
|
|
|
ENV G4F_DIR /app
|
|
|
|
|
|
|
|
RUN apt-get update && apt-get upgrade -y \
|
|
|
|
&& apt-get install -y git \
|
|
|
|
# Add user and user group
|
|
|
|
&& groupadd -g $G4F_USER_ID $G4F_USER \
|
|
|
|
&& useradd -rm -G sudo -u $G4F_USER_ID -g $G4F_USER_ID $G4F_USER \
|
2024-11-24 20:42:00 +03:00
|
|
|
&& echo "${G4F_USER}:${G4F_USER}" | chpasswd \
|
2024-11-25 01:34:59 +03:00
|
|
|
&& python -m pip install --upgrade pip \
|
|
|
|
&& apt-get clean \
|
|
|
|
&& rm --recursive --force /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
2024-11-17 13:06:37 +03:00
|
|
|
|
|
|
|
USER $G4F_USER_ID
|
|
|
|
WORKDIR $G4F_DIR
|
|
|
|
|
|
|
|
ENV HOME /home/$G4F_USER
|
2024-11-25 01:34:59 +03:00
|
|
|
ENV PATH "${HOME}/.local/bin:${PATH}"
|
2024-11-17 13:06:37 +03:00
|
|
|
|
|
|
|
# Create app dir and copy the project's requirements file into it
|
|
|
|
RUN mkdir -p $G4F_DIR
|
|
|
|
COPY requirements-slim.txt $G4F_DIR
|
|
|
|
|
|
|
|
# Upgrade pip for the latest features and install the project's Python dependencies.
|
2024-12-01 00:11:18 +03:00
|
|
|
RUN pip install --no-cache-dir -r requirements-slim.txt
|
2024-11-17 13:06:37 +03:00
|
|
|
|
|
|
|
# Copy the entire package into the container.
|
|
|
|
ADD --chown=$G4F_USER:$G4F_USER g4f $G4F_DIR/g4f
|