Update Dockerfile
Browse files- Dockerfile +13 -13
Dockerfile
CHANGED
|
@@ -8,26 +8,26 @@ RUN apt-get update && apt-get install -y \
|
|
| 8 |
&& apt-get install -y nodejs \
|
| 9 |
&& rm -rf /var/lib/apt/lists/*
|
| 10 |
|
| 11 |
-
# Masking
|
| 12 |
RUN ln -s $(command -v node) /usr/local/bin/python-internal-service && \
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
|
|
|
|
|
|
| 15 |
WORKDIR /home/user
|
| 16 |
|
| 17 |
-
# Install
|
| 18 |
RUN pip install --no-cache-dir fastapi uvicorn httpx websockets
|
| 19 |
|
| 20 |
-
#
|
| 21 |
USER user
|
| 22 |
COPY --chown=user:user . .
|
| 23 |
|
| 24 |
-
# Buat script sebagai user 1000 agar tidak ada issue chmod
|
| 25 |
-
RUN echo '#!/bin/bash' > entrypoint.sh && \
|
| 26 |
-
echo 'export NODE_OPTIONS="--dns-result-order=ipv4first"' >> entrypoint.sh && \
|
| 27 |
-
echo 'ttyd -p 8080 bash &' >> entrypoint.sh && \
|
| 28 |
-
echo 'if [ -f "bot.js" ]; then python-internal-service bot.js & fi' >> entrypoint.sh && \
|
| 29 |
-
echo 'python main.py' >> entrypoint.sh && \
|
| 30 |
-
chmod +x entrypoint.sh
|
| 31 |
-
|
| 32 |
EXPOSE 7860
|
| 33 |
-
|
|
|
|
|
|
| 8 |
&& apt-get install -y nodejs \
|
| 9 |
&& rm -rf /var/lib/apt/lists/*
|
| 10 |
|
| 11 |
+
# Masking & Create Global Script (Di luar /home/user agar tidak konflik)
|
| 12 |
RUN ln -s $(command -v node) /usr/local/bin/python-internal-service && \
|
| 13 |
+
printf "#!/bin/bash\n\
|
| 14 |
+
export NODE_OPTIONS='--dns-result-order=ipv4first'\n\
|
| 15 |
+
ttyd -p 8080 bash &\n\
|
| 16 |
+
if [ -f 'bot.js' ]; then python-internal-service bot.js & fi\n\
|
| 17 |
+
python main.py\n" > /usr/local/bin/start-app && \
|
| 18 |
+
chmod +x /usr/local/bin/start-app
|
| 19 |
|
| 20 |
+
# 2. USER PREP
|
| 21 |
+
RUN useradd -m -u 1000 user
|
| 22 |
WORKDIR /home/user
|
| 23 |
|
| 24 |
+
# Install deps sebagai root agar masuk ke cache sistem
|
| 25 |
RUN pip install --no-cache-dir fastapi uvicorn httpx websockets
|
| 26 |
|
| 27 |
+
# 3. FINAL COPY
|
| 28 |
USER user
|
| 29 |
COPY --chown=user:user . .
|
| 30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
EXPOSE 7860
|
| 32 |
+
# Panggil script global yang sudah kita buat tadi
|
| 33 |
+
CMD ["start-app"]
|