]>
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 | 19 | |
7f8963f6 GJ |
20 | |
21 | ARG DOMAIN | |
22 | ENV DOMAIN=$DOMAIN | |
23 | ARG FILE_DOMAIN | |
24 | ENV FILE_DOMAIN=$FILE_DOMAIN | |
25 | ARG CONTACT_EMAIL | |
26 | ENV CONTACT_EMAIL=$CONTACT_EMAIL | |
f7f02b92 GJ |
27 | ARG MAX_SIZE |
28 | ENV MAX_SIZE=$MAX_SIZE | |
7f8963f6 | 29 | |
b3c0237a | 30 | # Set default workdir |
0a6585a2 | 31 | WORKDIR /var/www/ |
32 | ||
33 | COPY docker/docker-entrypoint.sh . | |
34 | ||
e480c0e5 GJ |
35 | # Decompress into Docker |
36 | COPY docker/uguuForDocker.tar.gz /var/www/ | |
37 | RUN mkdir /var/www/uguu | |
38 | RUN tar -xvf uguuForDocker.tar.gz -C uguu | |
0a6585a2 | 39 | |
b3c0237a | 40 | # Create the needed directories |
e480c0e5 GJ |
41 | RUN mkdir /var/www/files && \ |
42 | mkdir /var/www/db | |
fca51030 | 43 | |
b3c0237a | 44 | # Create the Sqlite DB |
af4b9c42 | 45 | RUN sqlite3 /var/www/db/uguuDB.sq3 -init /var/www/uguu/src/static/dbSchemas/sqlite_schema.sql "" && \ |
b3c0237a | 46 | chown -R www-data:www-data /var/www && \ |
0a6585a2 | 47 | chmod -R 775 /var/www/ |
48 | ||
af4b9c42 GJ |
49 | # Add scripts to cron |
50 | RUN echo "0,30 * * * * bash /var/www/uguu/src/static/scripts/checkfiles.sh" >> /var/spool/cron/crontabs/www-data && \ | |
51 | echo "0,30 * * * * bash /var/www/uguu/src/static/scripts/checkdb.sh" >> /var/spool/cron/crontabs/www-data | |
52 | ||
b3c0237a | 53 | # Fix script paths |
e480c0e5 GJ |
54 | RUN chmod a+x /var/www/uguu/src/static/scripts/checkdb.sh && \ |
55 | chmod a+x /var/www/uguu/src/static/scripts/checkfiles.sh && \ | |
56 | sed -i 's#/path/to/files/#/var/www/uguu/files/#g' /var/www/uguu/src/static/scripts/checkfiles.sh && \ | |
57 | sed -i 's#/path/to/db/uguu.sq3#/var/www/db/uguu.sq3#g' /var/www/uguu/src/static/scripts/checkdb.sh | |
0a6585a2 | 58 | |
b3c0237a | 59 | # Copy Nginx Server conf |
af4b9c42 | 60 | COPY docker/nginx/uguu.conf /etc/nginx/sites-enabled/uguu.conf |
f7f02b92 | 61 | COPY docker/nginx/nginx.conf /etc/nginx/nginx.conf |
b3c0237a | 62 | |
f7f02b92 | 63 | # Modify nginx values |
7f8963f6 GJ |
64 | RUN sed -i "s#XMAINDOMAINX#${DOMAIN}#g" /etc/nginx/sites-enabled/uguu.conf |
65 | RUN sed -i "s#XFILESDOMAINX#${FILE_DOMAIN}#g" /etc/nginx/sites-enabled/uguu.conf | |
8e96eafc | 66 | RUN sed -i "s#client_max_body_size 128M#client_max_body_size ${MAX_SIZE}M#g" /etc/nginx/nginx.conf |
b3c0237a | 67 | |
f7f02b92 GJ |
68 | # Modify php-fpm values |
69 | RUN sed -i "s#post_max_size = 8M#post_max_size = ${MAX_SIZE}M#g" /etc/php/8.1/fpm/php.ini | |
70 | RUN sed -i "s#upload_max_filesize = 2M#upload_max_filesize = ${MAX_SIZE}M#g" /etc/php/8.1/fpm/php.ini | |
e480c0e5 | 71 | |
b3c0237a | 72 | # Copy Uguu config |
e480c0e5 | 73 | COPY src/config.json /var/www/uguu/config.json |
b3c0237a | 74 | |
b3c0237a | 75 | # Expose port 80 from the container |
0a6585a2 | 76 | EXPOSE 80 |
77 | ||
ccf3370a GJ |
78 | # Expose port 443 from the container |
79 | EXPOSE 443 | |
80 | ||
af4b9c42 GJ |
81 | #RUN service nginx restart |
82 | # Change user to www-data | |
83 | #USER www-data | |
84 | ||
85 | #RUN cd /var/www/uguu && make && make install | |
86 | ||
af4b9c42 GJ |
87 | RUN curl -o acmeinstall.sh https://get.acme.sh |
88 | RUN chmod a+x acmeinstall.sh | |
89 | RUN ./acmeinstall.sh | |
b3c0237a | 90 | # Load entrypoint |
fca51030 | 91 | ENTRYPOINT [ "bash", "/var/www/docker-entrypoint.sh" ] |