commit 098f86087d825378a5c6d49583137eea86df8cbb Author: imbytecat Date: Mon Mar 20 16:54:03 2023 +0800 init diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..ab41821 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,14 @@ +kind: pipeline +type: docker +name: default + +steps: + - name: build docker image + image: plugins/docker + settings: + username: + from_secret: docker_username + password: + from_secret: docker_password + repo: imbytecat/${DRONE_REPO_NAME} + tags: latest diff --git a/000-default.conf b/000-default.conf new file mode 100644 index 0000000..db71432 --- /dev/null +++ b/000-default.conf @@ -0,0 +1,30 @@ + + # The ServerName directive sets the request scheme, hostname and port that + # the server uses to identify itself. This is used when creating + # redirection URLs. In the context of virtual hosts, the ServerName + # specifies what hostname must appear in the request's Host: header to + # match this virtual host. For the default virtual host (this file) this + # value is not decisive as it is used as a last resort host regardless. + # However, you must set it for any further virtual host explicitly. + + ServerAdmin webmaster@localhost + DocumentRoot /var/www/html/public + + # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, + # error, crit, alert, emerg. + # It is also possible to configure the loglevel for particular + # modules, e.g. + #LogLevel info ssl:warn + + ErrorLog ${APACHE_LOG_DIR}/error.log + CustomLog ${APACHE_LOG_DIR}/access.log combined + + # For most configuration files from conf-available/, which are + # enabled or disabled at a global level, it is possible to + # include a line for only one particular virtual host. For example the + # following line enables the CGI configuration for this host only + # after it has been globally disabled with "a2disconf". + #Include conf-available/serve-cgi-bin.conf + + +# vim: syntax=apache ts=4 sw=4 sts=4 sr noet diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d15d252 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,36 @@ +FROM php:7.4-apache +ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/ +# 可以运行 docker run --rm php:7.4-alpine php -m 查看预装的拓展 +RUN a2enmod rewrite && chmod +x /usr/local/bin/install-php-extensions && \ + install-php-extensions pdo_mysql opcache && \ + \ + { \ + echo 'post_max_size = 100M;';\ + echo 'upload_max_filesize = 100M;';\ + echo 'max_execution_time = 600S;';\ + } > /usr/local/etc/php/conf.d/docker-php-upload.ini; \ + \ + { \ + echo 'opcache.enable=1'; \ + echo 'opcache.interned_strings_buffer=8'; \ + echo 'opcache.max_accelerated_files=10000'; \ + echo 'opcache.memory_consumption=128'; \ + echo 'opcache.save_comments=1'; \ + echo 'opcache.revalidate_freq=1'; \ + } > /usr/local/etc/php/conf.d/opcache-recommended.ini; \ + \ + echo 'apc.enable_cli=1' >> /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini; \ + \ + echo 'memory_limit=512M' > /usr/local/etc/php/conf.d/memory-limit.ini; \ + \ + mkdir /var/www/data; \ + chown -R www-data:root /var/www; \ + chmod -R g=u /var/www +COPY ./000-default.conf /etc/apache2/sites-enabled/ +COPY entrypoint.sh / +WORKDIR /var/www/html/ +VOLUME /var/www/html +EXPOSE 80 +RUN chmod a+x /entrypoint.sh +ENTRYPOINT ["/entrypoint.sh"] +CMD ["apachectl","-D","FOREGROUND"] diff --git a/README.md b/README.md new file mode 100644 index 0000000..ce71b58 --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +# lsky-pro-docker + +基于 `php-migrate-docker`,将老旧 PHP 项目迁移到 Docker 中运行 + +## 兰空图床 (Lsky Pro) + +为 `lsky-pro` 优化,使用 PHP 7.4 和 Apache diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..b436cf3 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,8 @@ +#!/bin/bash +set -eu + +chown -R www-data /var/www/html +chgrp -R www-data /var/www/html +chmod -R 755 /var/www/html/ + +exec "$@"