jmanhype
commited on
Commit
Β·
ff54b04
1
Parent(s):
8dc54dd
Update Dockerfile to match gradio structure with entrypoint script
Browse files- Dockerfile +26 -9
Dockerfile
CHANGED
|
@@ -1,33 +1,50 @@
|
|
| 1 |
FROM ubuntu:22.04
|
| 2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
# Install essential packages first
|
| 4 |
RUN apt-get update && apt-get install -y \
|
| 5 |
wget \
|
| 6 |
git \
|
| 7 |
&& rm -rf /var/lib/apt/lists/*
|
| 8 |
|
| 9 |
-
#
|
| 10 |
-
RUN useradd -m -
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
-
#
|
| 13 |
-
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
# Configure git for the user
|
| 17 |
RUN git config --global user.email "[email protected]" && \
|
| 18 |
git config --global user.name "jmanhype"
|
| 19 |
|
| 20 |
# This is a test Dockerfile to see if it's actually being used
|
| 21 |
-
RUN echo "TESTING IF THIS DOCKERFILE IS ACTUALLY USED" > /
|
| 22 |
echo "If you see this message, the correct Dockerfile is being used!"
|
| 23 |
|
| 24 |
# Create a very obvious test directory
|
| 25 |
-
RUN mkdir -p /
|
| 26 |
-
echo "TEST CONTENT" > /
|
| 27 |
|
| 28 |
# Print test message during build
|
| 29 |
RUN echo "=================================================" && \
|
| 30 |
echo "THIS IS A TEST BUILD - IF YOU SEE THIS, THE DOCKERFILE IS BEING USED" && \
|
| 31 |
echo "================================================="
|
| 32 |
|
| 33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
FROM ubuntu:22.04
|
| 2 |
|
| 3 |
+
LABEL MAINTAINER="jmanhype"
|
| 4 |
+
LABEL Description="Test dockerfile for Hugging Face Space"
|
| 5 |
+
|
| 6 |
+
SHELL ["/bin/bash", "--login", "-c"]
|
| 7 |
+
|
| 8 |
# Install essential packages first
|
| 9 |
RUN apt-get update && apt-get install -y \
|
| 10 |
wget \
|
| 11 |
git \
|
| 12 |
&& rm -rf /var/lib/apt/lists/*
|
| 13 |
|
| 14 |
+
# Set up a new user named "user" with user ID 1000
|
| 15 |
+
RUN useradd -m -u 1000 user
|
| 16 |
+
|
| 17 |
+
# Switch to the "user" user
|
| 18 |
+
USER user
|
| 19 |
|
| 20 |
+
# Set home to the user's home directory
|
| 21 |
+
ENV HOME=/home/user \
|
| 22 |
+
PATH=/home/user/.local/bin:$PATH
|
| 23 |
+
|
| 24 |
+
# Set the working directory to the user's home directory
|
| 25 |
+
WORKDIR $HOME/app
|
| 26 |
|
| 27 |
# Configure git for the user
|
| 28 |
RUN git config --global user.email "[email protected]" && \
|
| 29 |
git config --global user.name "jmanhype"
|
| 30 |
|
| 31 |
# This is a test Dockerfile to see if it's actually being used
|
| 32 |
+
RUN echo "TESTING IF THIS DOCKERFILE IS ACTUALLY USED" > $HOME/test_file.txt && \
|
| 33 |
echo "If you see this message, the correct Dockerfile is being used!"
|
| 34 |
|
| 35 |
# Create a very obvious test directory
|
| 36 |
+
RUN mkdir -p $HOME/THIS_IS_A_TEST_DIRECTORY && \
|
| 37 |
+
echo "TEST CONTENT" > $HOME/THIS_IS_A_TEST_DIRECTORY/test.txt
|
| 38 |
|
| 39 |
# Print test message during build
|
| 40 |
RUN echo "=================================================" && \
|
| 41 |
echo "THIS IS A TEST BUILD - IF YOU SEE THIS, THE DOCKERFILE IS BEING USED" && \
|
| 42 |
echo "================================================="
|
| 43 |
|
| 44 |
+
# Create and set up entrypoint script
|
| 45 |
+
RUN echo '#!/bin/bash\necho "Starting test..."\ncat $HOME/test_file.txt\necho "Test complete!"' > $HOME/entrypoint.sh && \
|
| 46 |
+
chmod +x $HOME/entrypoint.sh
|
| 47 |
+
|
| 48 |
+
EXPOSE 7860
|
| 49 |
+
|
| 50 |
+
CMD ["bash", "-c", "$HOME/entrypoint.sh"]
|