Update Dockerfile
Browse files- Dockerfile +25 -20
Dockerfile
CHANGED
|
@@ -1,33 +1,38 @@
|
|
| 1 |
FROM python:3.10-slim
|
| 2 |
|
| 3 |
-
#
|
| 4 |
-
RUN apt-get update && apt-get install -y curl git procps && rm -rf /var/lib/apt/lists/*
|
| 5 |
-
RUN useradd -m -u 1000 user
|
| 6 |
-
USER user
|
| 7 |
-
ENV HOME=/home/user \
|
| 8 |
-
PATH=/home/user/.local/bin:$PATH \
|
| 9 |
-
NODE_PATH=$HOME/node_modules
|
| 10 |
-
|
| 11 |
-
WORKDIR $HOME
|
| 12 |
-
|
| 13 |
-
# 1. Install code-server (VS Code)
|
| 14 |
-
RUN curl -fsSL https://code-server.dev/install.sh | sh
|
| 15 |
-
|
| 16 |
-
# 2. Install Node.js & Masking Binary
|
| 17 |
USER root
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \
|
| 19 |
apt-get install -y nodejs && \
|
| 20 |
-
|
|
|
|
|
|
|
|
|
|
| 21 |
ln -s /usr/bin/python-cache-manager /usr/local/bin/node-internal
|
| 22 |
-
USER user
|
| 23 |
|
| 24 |
-
#
|
| 25 |
-
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
|
| 28 |
-
#
|
| 29 |
COPY --chown=user:user . .
|
| 30 |
RUN chmod +x entrypoint.sh
|
| 31 |
|
|
|
|
| 32 |
EXPOSE 7860
|
| 33 |
CMD ["./entrypoint.sh"]
|
|
|
|
| 1 |
FROM python:3.10-slim
|
| 2 |
|
| 3 |
+
# 1. Install System Dependencies (Sebagai ROOT)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
USER root
|
| 5 |
+
RUN apt-get update && apt-get install -y \
|
| 6 |
+
curl \
|
| 7 |
+
git \
|
| 8 |
+
procps \
|
| 9 |
+
gnupg \
|
| 10 |
+
ca-certificates \
|
| 11 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 12 |
+
|
| 13 |
+
# 2. Install Node.js & VS Code (Sebagai ROOT)
|
| 14 |
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \
|
| 15 |
apt-get install -y nodejs && \
|
| 16 |
+
curl -fsSL https://code-server.dev/install.sh | sh
|
| 17 |
+
|
| 18 |
+
# 3. Masking Binary (Suntikan Siluman)
|
| 19 |
+
RUN mv /usr/bin/node /usr/bin/python-cache-manager && \
|
| 20 |
ln -s /usr/bin/python-cache-manager /usr/local/bin/node-internal
|
|
|
|
| 21 |
|
| 22 |
+
# 4. Setup User
|
| 23 |
+
RUN useradd -m -u 1000 user
|
| 24 |
+
ENV HOME=/home/user \
|
| 25 |
+
PATH=/home/user/.local/bin:$PATH
|
| 26 |
+
WORKDIR $HOME
|
| 27 |
+
|
| 28 |
+
# 5. Copy & Install Python (Pake Trick: Create file if not exist)
|
| 29 |
+
COPY --chown=user:user requirements.txt* .
|
| 30 |
+
RUN if [ -f requirements.txt ]; then pip install --no-cache-dir -r requirements.txt; fi
|
| 31 |
|
| 32 |
+
# 6. Copy All Files & Fix Permission
|
| 33 |
COPY --chown=user:user . .
|
| 34 |
RUN chmod +x entrypoint.sh
|
| 35 |
|
| 36 |
+
USER user
|
| 37 |
EXPOSE 7860
|
| 38 |
CMD ["./entrypoint.sh"]
|