]>
Commit | Line | Data |
---|---|---|
4717c936 | 1 | FROM alpine:latest |
0a6585a2 | 2 | |
3 | ARG VERSION | |
4 | ||
4717c936 GJ |
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 | |
0a6585a2 | 7 | |
4717c936 GJ |
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 | |
0a6585a2 | 20 | WORKDIR /var/www/ |
21 | ||
22 | COPY docker/docker-entrypoint.sh . | |
23 | ||
4717c936 | 24 | # Download Uguu |
9650e661 | 25 | ADD https://git.pomf.se/Pomf/uguu/archive/v${VERSION}.tar.gz v${VERSION}.tar.gz |
4717c936 | 26 | RUN tar xvf v${VERSION}.tar.gz |
0a6585a2 | 27 | |
4717c936 | 28 | # Create the needed directories |
0a6585a2 | 29 | RUN mkdir /var/www/uguu/dist && \ |
30 | mkdir /var/www/db && \ | |
31 | mkdir /var/www/files | |
4717c936 GJ |
32 | |
33 | # Create the Sqlite DB | |
0a6585a2 | 34 | RUN sqlite3 /var/www/db/uguu.sq3 -init /var/www/uguu/sqlite_schema.sql && \ |
4717c936 | 35 | chown -R www-data:www-data /var/www && \ |
0a6585a2 | 36 | chmod -R 775 /var/www/ |
37 | ||
4717c936 | 38 | # Fix script paths |
0a6585a2 | 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 && \ | |
4717c936 GJ |
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 | |
0a6585a2 | 59 | |
4717c936 GJ |
60 | # Change user to www-data |
61 | USER www-data | |
0a6585a2 | 62 | |
4717c936 | 63 | # Expose port 80 from the container |
0a6585a2 | 64 | EXPOSE 80 |
65 | ||
4717c936 GJ |
66 | # Load entrypoint |
67 | ENTRYPOINT [ "bash", "/var/www/docker-entrypoint.sh" ] |