-
Notifications
You must be signed in to change notification settings - Fork 65
Expand file tree
/
Copy pathDockerfile
More file actions
52 lines (43 loc) · 1.4 KB
/
Dockerfile
File metadata and controls
52 lines (43 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# Use PHP 8.3 as base image (compatible with >=8.3 requirement)
FROM php:8.3-cli
# Install system dependencies
RUN apt-get update && apt-get install -y \
git \
unzip \
wget \
&& rm -rf /var/lib/apt/lists/*
# Install Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# Install phar-composer tool
RUN wget -O /usr/local/bin/phar-composer.phar https://github.com/clue/phar-composer/releases/download/v1.4.0/phar-composer-1.4.0.phar \
&& chmod +x /usr/local/bin/phar-composer.phar
# Set working directory
WORKDIR /app
# Copy project files
COPY . .
# Build the phar file
RUN chmod +x build.sh \
&& ./build.sh
# Create a simple entrypoint script
RUN echo '#!/bin/bash\n\
if [ $# -eq 0 ]; then\n\
echo "Usage: docker run progpilot <path1> [path2] [path3] ..."\n\
echo "Example: docker run progpilot /path/to/php/files/ --configuration config.yml"\n\
exit 1\n\
fi\n\
\n\
# Find the latest built phar file\n\
PHAR_FILE=$(ls -t builds/progpilot_*.phar 2>/dev/null | head -1)\n\
\n\
if [ ! -f "$PHAR_FILE" ]; then\n\
echo "Error: No phar file found in builds directory"\n\
exit 1\n\
fi\n\
\n\
# Execute progpilot with all arguments\n\
php "$PHAR_FILE" "$@"' > /entrypoint.sh \
&& chmod +x /entrypoint.sh
# Set the entrypoint
ENTRYPOINT ["/entrypoint.sh"]
# Default command (will show usage if no arguments provided)
CMD []