]> jfr.im git - uguu.git/blame_incremental - docker/Dockerfile
Update 'docker/Dockerfile'
[uguu.git] / docker / Dockerfile
... / ...
CommitLineData
1FROM alpine:latest
2
3ARG VERSION
4
5# Install the needed software
6RUN 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
9RUN 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
14RUN ln -s /usr/bin/php8 /usr/bin/php
15
16# Copy supervisor conf file
17COPY docker/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
18
19# Set default workdir
20WORKDIR /var/www/
21
22COPY docker/docker-entrypoint.sh .
23
24# Download Uguu
25ADD https://git.pomf.se/Pomf/uguu/archive/v${VERSION}.tar.gz v${VERSION}.tar.gz
26RUN tar xvf v${VERSION}.tar.gz
27
28# Create the needed directories
29RUN mkdir /var/www/uguu/dist && \
30 mkdir /var/www/db && \
31 mkdir /var/www/files
32
33# Create the Sqlite DB
34RUN 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
39RUN 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
45RUN 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
49COPY docker/uguu.conf /etc/nginx/http.d/
50
51# Copy SSL certs
52COPY docker/ssl /etc/ssl
53
54# Copy Uguu config
55COPY dist.json /var/www/uguu/dist.json
56
57# Give permissions to www-data
58RUN 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
61USER www-data
62
63# Expose port 80 from the container
64EXPOSE 80
65
66# Load entrypoint
67ENTRYPOINT [ "bash", "/var/www/docker-entrypoint.sh" ]