Updating Dockerfile
Browse files- Dockerfile +4 -13
Dockerfile
CHANGED
@@ -1,37 +1,28 @@
|
|
1 |
-
# Dockerfile for FastAPI application (with Telegram bot and Redis) deployed on Hugging Face Spaces
|
2 |
FROM python:3.11-slim
|
3 |
|
4 |
-
# Install Redis server (requires root privileges)
|
5 |
USER root
|
6 |
RUN apt-get update && \
|
7 |
-
apt-get install -y redis-server && \
|
8 |
apt-get clean && \
|
9 |
rm -rf /var/lib/apt/lists/*
|
10 |
|
11 |
-
# Create and switch to a non-root user for security
|
12 |
RUN useradd -m -u 1000 user
|
13 |
USER user
|
14 |
|
15 |
-
# Ensure local binaries are in PATH and disable output buffering
|
16 |
ENV PATH="/home/user/.local/bin:$PATH" \
|
17 |
PYTHONUNBUFFERED=1
|
18 |
|
19 |
-
# Set the working directory
|
20 |
WORKDIR /app
|
21 |
|
22 |
-
# Install Python dependencies
|
23 |
COPY --chown=user ./requirements.txt requirements.txt
|
24 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
25 |
|
26 |
-
# Copy all application code into the container
|
27 |
COPY --chown=user . /app
|
28 |
|
29 |
-
# Copy the entrypoint script into the container and make it executable
|
30 |
COPY --chown=user entrypoint.sh /app/entrypoint.sh
|
31 |
-
RUN
|
|
|
32 |
|
33 |
-
# Expose the port used by the FastAPI app (Hugging Face Spaces expects this)
|
34 |
EXPOSE 7860
|
35 |
|
36 |
-
|
37 |
-
CMD ["/app/entrypoint.sh"]
|
|
|
|
|
1 |
FROM python:3.11-slim
|
2 |
|
|
|
3 |
USER root
|
4 |
RUN apt-get update && \
|
5 |
+
apt-get install -y redis-server dos2unix && \
|
6 |
apt-get clean && \
|
7 |
rm -rf /var/lib/apt/lists/*
|
8 |
|
|
|
9 |
RUN useradd -m -u 1000 user
|
10 |
USER user
|
11 |
|
|
|
12 |
ENV PATH="/home/user/.local/bin:$PATH" \
|
13 |
PYTHONUNBUFFERED=1
|
14 |
|
|
|
15 |
WORKDIR /app
|
16 |
|
|
|
17 |
COPY --chown=user ./requirements.txt requirements.txt
|
18 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
19 |
|
|
|
20 |
COPY --chown=user . /app
|
21 |
|
|
|
22 |
COPY --chown=user entrypoint.sh /app/entrypoint.sh
|
23 |
+
RUN dos2unix /app/entrypoint.sh && \
|
24 |
+
chmod +x /app/entrypoint.sh
|
25 |
|
|
|
26 |
EXPOSE 7860
|
27 |
|
28 |
+
CMD ["/app/entrypoint.sh"]
|
|