-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from fordes123/dev
ci: 👷 新增本地开发环境
- Loading branch information
Showing
7 changed files
with
395 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
http://*:80 { | ||
root * /var/www/html/typecho | ||
encode gzip | ||
@disallowed { | ||
path_regexp forbidden_files "^/(\.user\.ini|\.htaccess|\.git|\.svn|\.project|LICENSE.*|README.*)$" | ||
} | ||
rewrite @disallowed /index.php | ||
|
||
php_fastcgi php-fpm:9000 | ||
file_server { | ||
index index.html | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
FROM caddy/caddy:alpine | ||
|
||
VOLUME [ "/var/www/typecho" ] | ||
COPY config.inc.php /var/www/html/typecho/ | ||
|
||
RUN apk update \ | ||
&& apk add alpine-conf wget unzip --no-cache \ | ||
&& /sbin/setup-timezone -z Asia/Shanghai \ | ||
&& wget https://github.com/typecho/typecho/releases/latest/download/typecho.zip \ | ||
&& mkdir -p /var/www/html/typecho \ | ||
&& unzip typecho.zip -d /var/www/html/typecho \ | ||
&& rm typecho.zip \ | ||
&& apk del alpine-conf wget unzip |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
// site root path | ||
define('__TYPECHO_ROOT_DIR__', dirname(__FILE__)); | ||
|
||
// plugin directory (relative path) | ||
define('__TYPECHO_PLUGIN_DIR__', '/usr/plugins'); | ||
|
||
// theme directory (relative path) | ||
define('__TYPECHO_THEME_DIR__', '/usr/themes'); | ||
|
||
// admin directory (relative path) | ||
define('__TYPECHO_ADMIN_DIR__', '/admin/'); | ||
|
||
// register autoload | ||
require_once __TYPECHO_ROOT_DIR__ . '/var/Typecho/Common.php'; | ||
|
||
// init | ||
\Typecho\Common::init(); | ||
|
||
// config db | ||
$db = new \Typecho\Db('Pdo_Mysql', 'item_'); | ||
$db->addServer(array ( | ||
'host' => 'mysql', | ||
'port' => 3306, | ||
'user' => 'typecho', | ||
'password' => '12345678', | ||
'charset' => 'utf8mb4', | ||
'database' => 'typecho', | ||
'engine' => 'InnoDB', | ||
'sslCa' => '', | ||
'sslVerify' => false, | ||
), \Typecho\Db::READ | \Typecho\Db::WRITE); | ||
\Typecho\Db::set($db); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
networks: | ||
default: | ||
external: false | ||
name: typecho-debug | ||
|
||
volumes: | ||
typecho: | ||
|
||
services: | ||
mysql: | ||
image: mysql:8.0 | ||
container_name: mysql | ||
restart: always | ||
volumes: | ||
- ./mysql:/docker-entrypoint-initdb.d/ | ||
environment: | ||
TZ: Asia/Shanghai | ||
MYSQL_DATABASE: typecho | ||
MYSQL_USER: typecho | ||
MYSQL_PASSWORD: 12345678 | ||
MYSQL_ROOT_PASSWORD: 12345678 | ||
command: | ||
- --character-set-server=utf8mb4 | ||
- --collation-server=utf8mb4_unicode_ci | ||
networks: | ||
- default | ||
|
||
caddy: | ||
build: ./caddy | ||
container_name: caddy | ||
restart: always | ||
environment: | ||
TZ: Asia/Shanghai | ||
volumes: | ||
- ./caddy/Caddyfile:/etc/caddy/Caddyfile | ||
- ../:/var/www/html/typecho/usr/themes/ITEM | ||
- typecho:/var/www/html/typecho:copy | ||
ports: | ||
- 80:80 | ||
depends_on: | ||
- php-fpm | ||
networks: | ||
- default | ||
|
||
php-fpm: | ||
build: ./php-fpm | ||
container_name: php-fpm | ||
restart: always | ||
environment: | ||
TZ: Asia/Shanghai | ||
volumes: | ||
- ../:/var/www/html/typecho/usr/themes/ITEM | ||
- typecho:/var/www/html/typecho:rw | ||
networks: | ||
- default | ||
depends_on: | ||
- mysql | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM php:8.1.13-fpm-alpine | ||
RUN apk update \ | ||
&& apk add alpine-conf --no-cache \ | ||
&& /sbin/setup-timezone -z Asia/Shanghai \ | ||
&& apk del alpine-conf \ | ||
&& docker-php-ext-install pdo pdo_mysql calendar \ | ||
&& printf '[PHP]\ndate.timezone = Asia/Shanghai\n' >/usr/local/etc/php/conf.d/tzone.ini |
This file contains 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