diff --git a/Dockerfile b/Dockerfile index 162d13f..754ceea 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,34 +4,21 @@ 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 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 git -y 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 +WORKDIR /opt RUN git clone https://git.lat/w0bm/w0bm.git -COPY ./conf/.env /home/w0bm/w0bm/ -WORKDIR /home/w0bm/w0bm +COPY ./conf/.env /opt/w0bm/ +WORKDIR /opt/w0bm +RUN chown -R www-data:www-data /opt/w0bm RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" RUN php composer-setup.php --2.2 +USER www-data 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 +USER root ENTRYPOINT ["/entrypoint.sh"] \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..17792d5 --- /dev/null +++ b/README.md @@ -0,0 +1,21 @@ +# dw0 + +w0bm in docker + +This repository contains a working solution for easy deployment of the legacy [w0bm](https://git.lat/w0bm/w0bm) software + +To make use of this you can just pull this repo and build the image and or run the compose + +You still need to initialize the software and the database manually if you do not have a already existing initialized database. + +First of all put a .webm file named 1.webm in `w0bm-data/b` + +`docker exec -it w0bm-legacy /bin/bash` + +`php7.1 artisan migrate` + +`php7.1 artisan db:seed` + +`php7.1 artisan tags` + +Now visit http://localhost:8080 \ No newline at end of file diff --git a/conf/.env b/conf/.env index b51baec..657c182 100644 --- a/conf/.env +++ b/conf/.env @@ -18,5 +18,5 @@ RECAPTCHA_PRIVATE= MATRIX_MAUAUTH= MATRIX_MAUURL= -# if you are developing +# if you are developing else set to true SECURE_COOKIE=false \ No newline at end of file diff --git a/conf/nginx_w0bm.conf b/conf/nginx_w0bm.conf index 520fee8..36126da 100644 --- a/conf/nginx_w0bm.conf +++ b/conf/nginx_w0bm.conf @@ -3,7 +3,7 @@ server { server_name _; access_log /var/log/nginx/w0bm_access.log; error_log /var/log/nginx/w0bm_error.log; - root /home/w0bm/w0bm/public; + root /opt/w0bm/public; index index.php; client_max_body_size 500M; gzip on; diff --git a/docker-compose.yaml b/docker-compose.yaml index 4cf80dd..259be99 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,16 +1,19 @@ #w0bm legacy deployment services: - w0bm: + w0bm-legacy: container_name: w0bm-legacy - image: w0bm-legacy:latest #dev + image: w0bm-legacy:opt-1 #dev build: dockerfile: Dockerfile depends_on: - mariadb networks: - w0bm - # volumes: - # - foo:bar + volumes: + - ./w0bm-data/b:/opt/w0bm/public/b + - ./w0bm-data/thumbs:/opt/w0bm/public/thumbs + - ./w0bm-data/thumbs/beta:/opt/w0bm/public/thumbs/beta + - ./w0bm-data/images:/opt/w0bm/public/image ports: - "8080:8080" restart: on-failure @@ -26,9 +29,12 @@ services: - "3307:3306" networks: - w0bm + volumes: + - ./w0bm-db:/var/lib/mysql networks: w0bm: driver: bridge volumes: - w0bm: \ No newline at end of file + w0bm: + w0bm-db: \ No newline at end of file