]> jfr.im git - uguu.git/blob - docker/Dockerfile
minor changes
[uguu.git] / docker / Dockerfile
1 FROM php:8.1-alpine
2
3 ARG VERSION
4
5
6 RUN apk add --no-cache $PHPIZE_DEPS \
7 php-fpm zlib-dev libzip-dev libgomp; \
8 docker-php-ext-install intl pcntl gd exif zip pdo mysql dom; \
9 apk del $PHPIZE_DEPS; \
10 rm -rf /tmp/pear;
11
12 # Install the needed software
13 RUN apk add --no-cache sqlite nodejs git npm bash build-base supervisor curl wget nginx
14 #php8-fileinfo php8-pdo php8-tokenizer php8-dom php8-iconv php8-xml php8-simplexml \
15 #php8-sqlite3 php8-opcache php8-mbstring php8-phar php8-openssl
16
17 # Create the www-data user and group
18 #RUN set -x ; \
19 # addgroup -g 82 -S www-data ; \
20 # adduser -u 82 -D -S -G www-data www-data && exit 0 ; exit 1
21
22 # Copy supervisor conf file
23 COPY docker/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
24
25 # Set default workdir
26 WORKDIR /var/www/
27
28 COPY docker/docker-entrypoint.sh .
29
30 # Decompress into Docker
31 COPY docker/uguuForDocker.tar.gz /var/www/
32 RUN mkdir /var/www/uguu
33 RUN tar -xvf uguuForDocker.tar.gz -C uguu
34
35 # Create the needed directories
36 RUN mkdir /var/www/files && \
37 mkdir /var/www/db
38
39 # Create the Sqlite DB
40 RUN sqlite3 /var/www/db/uguu.sq3 -init /var/www/uguu/src/static/dbSchemas/sqlite_schema.sql && \
41 chown -R www-data:www-data /var/www && \
42 chmod -R 775 /var/www/
43
44 # Fix script paths
45 RUN chmod a+x /var/www/uguu/src/static/scripts/checkdb.sh && \
46 chmod a+x /var/www/uguu/src/static/scripts/checkfiles.sh && \
47 sed -i 's#/path/to/files/#/var/www/uguu/files/#g' /var/www/uguu/src/static/scripts/checkfiles.sh && \
48 sed -i 's#/path/to/db/uguu.sq3#/var/www/db/uguu.sq3#g' /var/www/uguu/src/static/scripts/checkdb.sh
49
50 # Add scripts to cron
51 RUN echo "0,30 * * * * bash /var/www/uguu/src/static/scripts/checkfiles.sh" >> /var/spool/cron/crontabs/www-data && \
52 echo "0,30 * * * * bash /var/www/uguu/src/static/scripts/checkdb.sh" >> /var/spool/cron/crontabs/www-data
53
54 # Copy Nginx Server conf
55 COPY docker/nginx/uguu.conf /etc/nginx/http.d/
56
57 # Copy SSL certs
58 COPY docker/ssl /etc/ssl
59
60 # Copy PHP config
61 COPY docker/php/php.ini /etc/php8/
62 COPY docker/php/www.conf /etc/php8/php-fpm.d/
63 RUN mkdir /var/run/php
64
65 # Copy Uguu config
66 COPY src/config.json /var/www/uguu/config.json
67
68 # Give permissions to www-data
69 RUN chown -R www-data:www-data /run /var/lib/nginx /var/log/nginx /etc/nginx /etc/php8 /var/log/php8 /var/run/php
70
71 # Change user to www-data
72 USER www-data
73
74 # Expose port 80 from the container
75 EXPOSE 80
76
77 # Expose port 443 from the container
78 EXPOSE 443
79
80 # Load entrypoint
81 ENTRYPOINT [ "bash", "/var/www/docker-entrypoint.sh" ]