teleapi / Dockerfile
BinaryONe
Nginx Changes
42d9b14
raw
history blame
1.21 kB
FROM alpine:latest
# Install system dependencies
RUN apk update && apk upgrade && \
apk add --no-cache nginx python3 python3-dev py3-pip build-base libffi-dev openssl-dev shadow gcc musl-dev ca-certificates
# Create a group and user
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
# Set working directory
WORKDIR /app
# Copy requirements and install in ONE combined RUN command
COPY requirements.txt /app/
RUN python3 -m venv /app/venv && \
/app/venv/bin/pip install --no-cache-dir --upgrade pip && \
/app/venv/bin/pip install --no-cache-dir -r requirements.txt && \
/app/venv/bin/pip list # Verify installation WITHIN THE SAME RUN COMMAND
# Copy the rest of the application code
COPY . /app
# Copy Nginx config
COPY nginx.conf /etc/nginx/conf.d/default.conf
# Create necessary directories and set correct permissions
RUN mkdir -p /var/www/html /var/log/nginx && \
chown -R nginx:nginx /var/log/nginx && \
chown -R appuser:appgroup /app /var/www/html
# Switch to non-root user
USER appuser
EXPOSE 7860
# Start Nginx and your application (using exec and the correct Python path)
CMD ["sh", "-c", "exec /app/venv/bin/python -u -m FileStream & nginx -g 'daemon off;'"]