]>
Commit | Line | Data |
---|---|---|
af4b9c42 GJ |
1 | FROM --platform=linux/amd64 debian:bullseye-slim |
2 | ||
3 | # Install needed software | |
4 | RUN apt-get update | |
5 | ||
6 | RUN apt-get install -y lsb-release ca-certificates apt-transport-https software-properties-common gnupg2 curl cron socat | |
7 | RUN echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/sury-php.list | |
8 | RUN curl -fsSL https://packages.sury.org/php/apt.gpg| gpg --dearmor -o /etc/apt/trusted.gpg.d/sury-keyring.gpg | |
9 | RUN apt-get update | |
10 | RUN apt-get upgrade -y | |
11 | RUN curl -o nodejssetup.sh https://deb.nodesource.com/setup_19.x | |
12 | RUN chmod a+x nodejssetup.sh | |
13 | RUN ./nodejssetup.sh | |
14 | RUN apt-get install -y nodejs gcc g++ make | |
15 | RUN apt-get install -y build-essential nginx-full php8.1-fpm php8.1 sqlite3 php8.1-sqlite3 \ | |
16 | php8.1-curl php8.1-cli php8.1-lz4 \ | |
17 | php8.1-mcrypt php8.1-mysql php8.1-xdebug php8.1-zip \ | |
18 | php8.1-common php8.1-readline php8.1-bcmath php8.1-common php8.1-xml | |
b3c0237a GJ |
19 | |
20 | # Set default workdir | |
0a6585a2 | 21 | WORKDIR /var/www/ |
22 | ||
23 | COPY docker/docker-entrypoint.sh . | |
24 | ||
e480c0e5 GJ |
25 | # Decompress into Docker |
26 | COPY docker/uguuForDocker.tar.gz /var/www/ | |
27 | RUN mkdir /var/www/uguu | |
28 | RUN tar -xvf uguuForDocker.tar.gz -C uguu | |
0a6585a2 | 29 | |
b3c0237a | 30 | # Create the needed directories |
e480c0e5 GJ |
31 | RUN mkdir /var/www/files && \ |
32 | mkdir /var/www/db | |
fca51030 | 33 | |
b3c0237a | 34 | # Create the Sqlite DB |
af4b9c42 | 35 | RUN sqlite3 /var/www/db/uguuDB.sq3 -init /var/www/uguu/src/static/dbSchemas/sqlite_schema.sql "" && \ |
b3c0237a | 36 | chown -R www-data:www-data /var/www && \ |
0a6585a2 | 37 | chmod -R 775 /var/www/ |
38 | ||
af4b9c42 GJ |
39 | # Add scripts to cron |
40 | RUN echo "0,30 * * * * bash /var/www/uguu/src/static/scripts/checkfiles.sh" >> /var/spool/cron/crontabs/www-data && \ | |
41 | echo "0,30 * * * * bash /var/www/uguu/src/static/scripts/checkdb.sh" >> /var/spool/cron/crontabs/www-data | |
42 | ||
b3c0237a | 43 | # Fix script paths |
e480c0e5 GJ |
44 | RUN chmod a+x /var/www/uguu/src/static/scripts/checkdb.sh && \ |
45 | chmod a+x /var/www/uguu/src/static/scripts/checkfiles.sh && \ | |
46 | sed -i 's#/path/to/files/#/var/www/uguu/files/#g' /var/www/uguu/src/static/scripts/checkfiles.sh && \ | |
47 | sed -i 's#/path/to/db/uguu.sq3#/var/www/db/uguu.sq3#g' /var/www/uguu/src/static/scripts/checkdb.sh | |
0a6585a2 | 48 | |
b3c0237a | 49 | # Copy Nginx Server conf |
af4b9c42 | 50 | COPY docker/nginx/uguu.conf /etc/nginx/sites-enabled/uguu.conf |
b3c0237a | 51 | |
af4b9c42 | 52 | #RUN sed -i 's#XXX#$()#g' /var/www/uguu/src/static/scripts/checkfiles.sh |
b3c0237a | 53 | |
af4b9c42 GJ |
54 | # Copy SSL certs |
55 | #COPY docker/ssl /etc/ssl | |
e480c0e5 | 56 | |
b3c0237a | 57 | # Copy Uguu config |
e480c0e5 | 58 | COPY src/config.json /var/www/uguu/config.json |
b3c0237a | 59 | |
b3c0237a | 60 | # Expose port 80 from the container |
0a6585a2 | 61 | EXPOSE 80 |
62 | ||
ccf3370a GJ |
63 | # Expose port 443 from the container |
64 | EXPOSE 443 | |
65 | ||
af4b9c42 GJ |
66 | #RUN service nginx restart |
67 | # Change user to www-data | |
68 | #USER www-data | |
69 | ||
70 | #RUN cd /var/www/uguu && make && make install | |
71 | ||
72 | ARG DOMAIN | |
73 | ENV DOMAIN=$DOMAIN | |
74 | ARG FILE_DOMAIN | |
75 | ENV FILE_DOMAIN=$FILE_DOMAIN | |
76 | ARG CONTACT_EMAIL | |
77 | ENV CONTACT_EMAIL=$CONTACT_EMAIL | |
78 | RUN curl -o acmeinstall.sh https://get.acme.sh | |
79 | RUN chmod a+x acmeinstall.sh | |
80 | RUN ./acmeinstall.sh | |
b3c0237a | 81 | # Load entrypoint |
fca51030 | 82 | ENTRYPOINT [ "bash", "/var/www/docker-entrypoint.sh" ] |