w0bm goes docker

This commit is contained in:
x
2025-09-06 02:02:59 +02:00
commit e292217d0e
5 changed files with 130 additions and 0 deletions

37
Dockerfile Normal file
View File

@@ -0,0 +1,37 @@
# w0bm legacy
FROM debian:bookworm
COPY ./conf/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
RUN apt update -y
RUN apt install sudo curl -y
# add w0bm user
RUN useradd -ms /bin/bash w0bm
# get php 7.1 from sury
RUN curl -sSL https://packages.sury.org/php/README.txt | bash -x
RUN apt update -y
RUN apt install php7.1 php7.1-cli php7.1-ctype php7.1-curl php7.1-fileinfo php7.1-fpm php7.1-gd php7.1-iconv php7.1-mysql php7.1-opcache php7.1-pdo php7.1-phar php7.1-tokenizer php7.1-zip php7.1-json php7.1-mbstring php7.1-dom nginx ffmpeg imagemagick npm iputils-ping -y
# w0bm specifc php changes
RUN sed -i 's/^post_max_size = .*/post_max_size = 500M/' /etc/php/7.1/cli/php.ini
RUN sed -i 's/^upload_max_size = .*/upload_max_size = 100M/' /etc/php/7.1/cli/php.ini
# RUN sed -i 's/^user = .*/user = w0bm/' /etc/php/7.1/fpm/pool.d/www.conf
# RUN sed -i 's/^group = .*/group = w0bm/' /etc/php/7.1/fpm/pool.d/www.conf
# RUN sed -i 's/^listen.owner = .*/listen.owner = w0bm/' /etc/php/7.1/fpm/pool.d/www.conf
# RUN sed -i 's/^listen.group = .*/listen.group = w0bm/' /etc/php/7.1/fpm/pool.d/www.conf
# maybe if I want to start php-fpm as w0bm user
# RUN sed -i 's%^[; ]*error_log *=.*%error_log = /proc/self/fd/2%' /etc/php/7.1/fpm/php-fpm.conf
# USER w0bm
# RUN php-fpm7.1 -F
COPY ./conf/nginx_w0bm.conf /etc/nginx/conf.d/nginx_w0bm.conf
WORKDIR /home/w0bm
RUN git clone https://git.lat/w0bm/w0bm.git
COPY ./conf/.env /home/w0bm/w0bm/
WORKDIR /home/w0bm/w0bm
RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
RUN php composer-setup.php --2.2
RUN php7.1 composer.phar dump-autoload
RUN php7.1 composer.phar install --no-scripts
RUN mkdir /home/w0bm/w0bm/public/b
RUN mkdir /home/w0bm/w0bm/public/thumbs
RUN mkdir /home/w0bm/w0bm/public/thumbs/beta
RUN chown -R www-data:www-data /home/w0bm/w0bm
ENTRYPOINT ["/entrypoint.sh"]

22
conf/.env Normal file
View File

@@ -0,0 +1,22 @@
APP_KEY=HiH8VKcsazpxFCTWm5ir3TS9g8RmnVTR
APP_ENV=development
APP_DEBUG=true
DB_HOST=w0bm-db
DB_PORT=3307
DB_DATABASE=w0bm
DB_USERNAME=w0bm
DB_PASSWORD=w0bm
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync
RECAPTCHA_PUBLIC=
RECAPTCHA_PRIVATE=
MATRIX_MAUAUTH=
MATRIX_MAUURL=
# if you are developing
SECURE_COOKIE=false

4
conf/entrypoint.sh Normal file
View File

@@ -0,0 +1,4 @@
#!/bin/bash
set -e
php-fpm7.1 -F &
exec nginx -g "daemon off;"

33
conf/nginx_w0bm.conf Normal file
View File

@@ -0,0 +1,33 @@
server {
listen 8080 default_server;
server_name _;
access_log /var/log/nginx/w0bm_access.log;
error_log /var/log/nginx/w0bm_error.log;
root /home/w0bm/w0bm/public;
index index.php;
client_max_body_size 500M;
gzip on;
large_client_header_buffers 4 32k;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_index index.php;
include fastcgi.conf;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_script_name;
#fastcgi_param GEOIP_ADDR $remote_addr;
#fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:/run/php/php7.1-fpm.sock;
}
location ~* \.(?:css|js)$ {
gzip on;
expires 1y;
add_header Cache-Control "public";
}
location ~* \.(?:jpg|jpeg|gif|png|ico|svg)$ {
expires 1M;
access_log off;
add_header Cache-Control "public";
}
location / {
try_files $uri $uri/ /index.php?$args;
}
}

34
docker-compose.yaml Normal file
View File

@@ -0,0 +1,34 @@
#w0bm legacy deployment
services:
w0bm:
container_name: w0bm-legacy
image: w0bm-legacy:latest #dev
build:
dockerfile: Dockerfile
depends_on:
- mariadb
networks:
- w0bm
# volumes:
# - foo:bar
ports:
- "8080:8080"
restart: on-failure
mariadb:
image: mariadb:latest
container_name: w0bm-db
environment:
MARIADB_ROOT_PASSWORD: root
MARIADB_DATABASE: w0bm
MARIADB_USER: w0bm
MARIADB_PASSWORD: w0bm
ports:
- "3307:3306"
networks:
- w0bm
networks:
w0bm:
driver: bridge
volumes:
w0bm: