Spaces:
Sleeping
Sleeping
Upload Dockerfile with huggingface_hub
Browse files- Dockerfile +76 -0
Dockerfile
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM php:7.4-apache
|
| 2 |
+
|
| 3 |
+
# Expose HuggingFace default port
|
| 4 |
+
EXPOSE 7860
|
| 5 |
+
|
| 6 |
+
# Install required PHP extensions and dependencies
|
| 7 |
+
RUN apt-get update && apt-get install -y \
|
| 8 |
+
libpng-dev \
|
| 9 |
+
libjpeg-dev \
|
| 10 |
+
libfreetype6-dev \
|
| 11 |
+
libzip-dev \
|
| 12 |
+
libxml2-dev \
|
| 13 |
+
libcurl4-openssl-dev \
|
| 14 |
+
libmcrypt-dev \
|
| 15 |
+
unzip \
|
| 16 |
+
wget \
|
| 17 |
+
git \
|
| 18 |
+
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
|
| 19 |
+
&& docker-php-ext-install -j$(nproc) \
|
| 20 |
+
gd \
|
| 21 |
+
mysqli \
|
| 22 |
+
pdo \
|
| 23 |
+
pdo_mysql \
|
| 24 |
+
zip \
|
| 25 |
+
soap \
|
| 26 |
+
curl \
|
| 27 |
+
xml \
|
| 28 |
+
mbstring \
|
| 29 |
+
&& a2enmod rewrite expires headers \
|
| 30 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 31 |
+
|
| 32 |
+
# Configure Apache for port 7860
|
| 33 |
+
RUN sed -i 's/80/7860/g' /etc/apache2/sites-available/000-default.conf /etc/apache2/ports.conf
|
| 34 |
+
|
| 35 |
+
# Set ServerName
|
| 36 |
+
RUN echo "ServerName localhost" >> /etc/apache2/apache2.conf
|
| 37 |
+
|
| 38 |
+
# Download and extract ProcessMaker
|
| 39 |
+
WORKDIR /tmp
|
| 40 |
+
RUN wget https://huggingface.co/spaces/kenken999/processmaker-runner/resolve/main/processmaker-3.2.3-community.tar.gz -O processmaker.tar.gz || \
|
| 41 |
+
echo "Will use existing tar.gz from base image"
|
| 42 |
+
|
| 43 |
+
# Extract ProcessMaker to Apache DocumentRoot
|
| 44 |
+
RUN if [ -f /tmp/processmaker.tar.gz ]; then \
|
| 45 |
+
tar -xzf /tmp/processmaker.tar.gz -C /tmp && \
|
| 46 |
+
if [ -d /tmp/processmaker ]; then \
|
| 47 |
+
cp -r /tmp/processmaker/* /var/www/html/ && \
|
| 48 |
+
rm -rf /tmp/processmaker /tmp/processmaker.tar.gz; \
|
| 49 |
+
fi; \
|
| 50 |
+
fi
|
| 51 |
+
|
| 52 |
+
# Copy ProcessMaker files (if provided locally)
|
| 53 |
+
COPY processmaker-files/ /var/www/html/ 2>/dev/null || true
|
| 54 |
+
|
| 55 |
+
# Set permissions
|
| 56 |
+
RUN chown -R www-data:www-data /var/www/html \
|
| 57 |
+
&& chmod -R 755 /var/www/html
|
| 58 |
+
|
| 59 |
+
# Set DocumentRoot to workflow/public_html if it exists
|
| 60 |
+
RUN if [ -d /var/www/html/workflow/public_html ]; then \
|
| 61 |
+
sed -i 's|DocumentRoot /var/www/html|DocumentRoot /var/www/html/workflow/public_html|' /etc/apache2/sites-available/000-default.conf; \
|
| 62 |
+
fi
|
| 63 |
+
|
| 64 |
+
# Environment variables for database (will use Hugging Face Secrets)
|
| 65 |
+
ENV DB_HOST=${DB_HOST:-localhost}
|
| 66 |
+
ENV DB_PORT=${DB_PORT:-3306}
|
| 67 |
+
ENV DB_NAME=${DB_NAME:-processmaker}
|
| 68 |
+
ENV DB_USER=${DB_USER:-root}
|
| 69 |
+
ENV DB_PASS=${DB_PASS:-}
|
| 70 |
+
|
| 71 |
+
# Copy entrypoint script
|
| 72 |
+
COPY entrypoint.sh /entrypoint.sh
|
| 73 |
+
RUN chmod +x /entrypoint.sh
|
| 74 |
+
|
| 75 |
+
ENTRYPOINT ["/entrypoint.sh"]
|
| 76 |
+
CMD ["apache2-foreground"]
|