]> jfr.im git - uguu.git/blob - docker/Dockerfile
Update 'docker/Dockerfile'
[uguu.git] / docker / Dockerfile
1 FROM alpine:latest
2
3 ARG VERSION
4
5 # Install the needed software
6 RUN apk add --no-cache curl nginx php8-fpm php8-sqlite3 php8-opcache sqlite nodejs git npm bash build-base supervisor
7
8 # Create the www-data user and group
9 RUN set -x ; \
10 addgroup -g 82 -S www-data ; \
11 adduser -u 82 -D -S -G www-data www-data && exit 0 ; exit 1
12
13 # Link php bin
14 RUN ln -s /usr/bin/php8 /usr/bin/php
15
16 # Copy supervisor conf file
17 COPY docker/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
18
19 # Set default workdir
20 WORKDIR /var/www/
21
22 COPY docker/docker-entrypoint.sh .
23
24 # Download Uguu
25 ADD https://git.pomf.se/Pomf/uguu/archive/v${VERSION}.tar.gz v${VERSION}.tar.gz
26 RUN tar xvf v${VERSION}.tar.gz
27
28 # Create the needed directories
29 RUN mkdir /var/www/uguu/dist && \
30 mkdir /var/www/db && \
31 mkdir /var/www/files
32
33 # Create the Sqlite DB
34 RUN sqlite3 /var/www/db/uguu.sq3 -init /var/www/uguu/sqlite_schema.sql && \
35 chown -R www-data:www-data /var/www && \
36 chmod -R 775 /var/www/
37
38 # Fix script paths
39 RUN chmod a+x /var/www/uguu/checkdb.sh && \
40 chmod a+x /var/www/uguu/checkfiles.sh && \
41 sed -i 's#/path/to/files/#/var/www/uguu/files/#g' /var/www/uguu/checkfiles.sh && \
42 sed -i 's#/path/to/db/uguu.sq3#/var/www/db/uguu.sq3#g' /var/www/uguu/checkdb.sh
43
44 # Add scripts to cron
45 RUN echo "0,30 * * * * bash /var/www/uguu/checkfiles.sh" >> /var/spool/cron/crontabs/www-data && \
46 echo "0,30 * * * * bash /var/www/uguu/checkdb.sh" >> /var/spool/cron/crontabs/www-data
47
48 # Copy Nginx Server conf
49 COPY docker/uguu.conf /etc/nginx/http.d/
50
51 # Copy SSL certs
52 COPY docker/ssl /etc/ssl
53
54 # Copy Uguu config
55 COPY dist.json /var/www/uguu/dist.json
56
57 # Give permissions to www-data
58 RUN chown -R www-data:www-data /run /var/lib/php8 /var/lib/nginx /var/log/nginx /var/log/php8 /etc/nginx /etc/php8
59
60 # Change user to www-data
61 USER www-data
62
63 # Expose port 80 from the container
64 EXPOSE 80
65
66 # Expose port 443 from the container
67 EXPOSE 443
68
69 # Load entrypoint
70 ENTRYPOINT [ "bash", "/var/www/docker-entrypoint.sh" ]