返回提交历史
Modified
docker/Dockerfile
+10
-19
XFEstudio/gpt4free
Refactor: Optimize Dockerfile structure
Combined some multiple RUN commands to reduce Docker container layers. Moved the rm cache cleaning command after the apt-get installation command for smaller laysr size.
a795e482
代码差异
1 个文件
+10
-19
@@ -30,20 +30,13 @@ RUN if [ "$G4F_VERSION" = "" ] ; then \
30
30
apt-get -qqy install git \
31
31
; fi
32
32
33
# Python packages
33
# Install Python3, pip, remove OpenJDK 11, clean up
34
34
RUN apt-get -qqy update \
35
&& apt-get -qqy install \
36
python3 \
37
python-is-python3 \
38
pip
39
40
# Remove java
41
RUN apt-get -qyy remove openjdk-11-jre-headless
42
43
# Cleanup
44
RUN rm -rf /var/lib/apt/lists/* /var/cache/apt/* \
35
&& apt-get -qqy install python3 python-is-python3 pip \
36
&& apt-get -qyy remove openjdk-11-jre-headless \
45
37
&& apt-get -qyy autoremove \
46
&& apt-get -qyy clean
38
&& apt-get -qyy clean \
39
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/*
47
40
48
41
# Update entrypoint
49
42
COPY docker/supervisor.conf /etc/supervisor/conf.d/selenium.conf
@@ -57,15 +50,13 @@ RUN if [ "$G4F_NO_GUI" ] ; then \
57
50
# Change background image
58
51
COPY docker/background.png /usr/share/images/fluxbox/ubuntu-light.png
59
52
60
# Add user
53
# Add user, fix permissions
61
54
RUN groupadd -g $G4F_USER_ID $G4F_USER \
62
55
&& useradd -rm -G sudo -u $G4F_USER_ID -g $G4F_USER_ID $G4F_USER \
63
&& echo "${G4F_USER}:${G4F_PASS}" | chpasswd
64
65
# Fix permissions
66
RUN mkdir "${SE_DOWNLOAD_DIR}"
67
RUN chown "${G4F_USER_ID}:${G4F_USER_ID}" $SE_DOWNLOAD_DIR /var/run/supervisor /var/log/supervisor
68
RUN chown "${G4F_USER_ID}:${G4F_USER_ID}" -R /opt/bin/ /usr/bin/chromedriver /opt/selenium/
56
&& echo "${G4F_USER}:${G4F_PASS}" | chpasswd \
57
&& mkdir "${SE_DOWNLOAD_DIR}" \
58
&& chown "${G4F_USER_ID}:${G4F_USER_ID}" $SE_DOWNLOAD_DIR /var/run/supervisor /var/log/supervisor \
59
&& chown "${G4F_USER_ID}:${G4F_USER_ID}" -R /opt/bin/ /usr/bin/chromedriver /opt/selenium/
69
60
70
61
# Switch user
71
62
USER $G4F_USER_ID