Created
May 28, 2026 11:20
-
-
Save joswr1ght/7699857550ab0939a13cd26fd33d892d to your computer and use it in GitHub Desktop.
Dockerfile and launch shell script for Droppy File Sharing Software
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM php:8.1-apache | |
| ENV DEBIAN_FRONTEND=noninteractive | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| mariadb-server \ | |
| mariadb-client \ | |
| libpng-dev \ | |
| libjpeg-dev \ | |
| libzip-dev \ | |
| libonig-dev \ | |
| && docker-php-ext-configure gd --with-jpeg \ | |
| && docker-php-ext-install -j"$(nproc)" mysqli gd zip \ | |
| && a2enmod rewrite \ | |
| && rm -rf /var/lib/apt/lists/* | |
| COPY docker/php.ini /usr/local/etc/php/conf.d/zz-droppy.ini | |
| # Apache: allow .htaccess overrides on the docroot so Files/.htaccess takes effect. | |
| RUN sed -ri \ | |
| -e 's!<Directory /var/www/>!<Directory /var/www/>\n AllowOverride All!' \ | |
| /etc/apache2/apache2.conf | |
| COPY Files/ /var/www/html/ | |
| RUN chown -R www-data:www-data /var/www/html | |
| # Sample files staged for the entrypoint. Create this directory and put some images or other target content here. | |
| COPY samplefiles/ /opt/droppy-samples/ | |
| # Seed scripts. | |
| COPY docker/uploads-schema.sql /opt/droppy-seed/uploads-schema.sql | |
| COPY docker/seed-samples.sh /opt/droppy-seed/seed-samples.sh | |
| COPY docker/entrypoint.sh /usr/local/bin/entrypoint.sh | |
| RUN chmod +x /opt/droppy-seed/seed-samples.sh /usr/local/bin/entrypoint.sh | |
| # DB credentials baked into config (entrypoint provisions matching user). | |
| RUN sed -i \ | |
| -e "s/'hostname' => 'localhost',/'hostname' => '127.0.0.1',/" \ | |
| -e "s/'username' => '',/'username' => 'droppy',/" \ | |
| -e "s/'password' => '',/'password' => 'droppy',/" \ | |
| -e "s/'database' => '',/'database' => 'droppy',/" \ | |
| /var/www/html/application/config/database.php | |
| # Neutralize the runtime proxibolt update-check: short-circuit callProxibolt() | |
| # before its curl_init line. Kept as the only outbound call AdminLib makes. | |
| RUN sed -i 's|\$ch = curl_init|return false; \$ch = curl_init|' \ | |
| /var/www/html/application/libraries/AdminLib.php | |
| # Belt-and-suspenders blackhole for api.proxibolt.com is appended to /etc/hosts | |
| # at container start (the entrypoint does it; Docker rewrites /etc/hosts on | |
| # `docker run`, so a build-time entry would be lost). The AdminLib patch above | |
| # is the primary defense. | |
| EXPOSE 80 | |
| ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| set -euo pipefail | |
| IMAGE="droppy:local" | |
| PORT="${PORT:-8080}" | |
| HERE="$(cd "$(dirname "$0")" && pwd)" | |
| if [[ "${1:-}" == "--rebuild" ]]; then | |
| docker build -t "$IMAGE" "$HERE" | |
| elif ! docker image inspect "$IMAGE" >/dev/null 2>&1; then | |
| docker build -t "$IMAGE" "$HERE" | |
| fi | |
| cat <<EOF >&2 | |
| godroppy: starting on http://localhost:${PORT} | |
| admin login: admin@droppy.local / admin (at /admin/login) | |
| user login: droppy@droppy.local / droppy (at /login) | |
| samples (owned by droppy@droppy.local): /SAMPL001 /SAMPL002 /SAMPL003 | |
| Ctrl+C to stop and discard state. | |
| EOF | |
| exec docker run --rm -it -p "${PORT}:80" "$IMAGE" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment