]> jfr.im git - uguu.git/blob - docker/Dockerfile
4ec2ea8972841b57c72c2a9d8dbdf450de129f76
[uguu.git] / docker / Dockerfile
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
19
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
27
28 # Set default workdir
29 WORKDIR /var/www/
30
31 COPY docker/docker-entrypoint.sh .
32
33 # Decompress into Docker
34 COPY docker/uguuForDocker.tar.gz /var/www/
35 RUN mkdir /var/www/uguu
36 RUN tar -xvf uguuForDocker.tar.gz -C uguu
37
38 # Create the needed directories
39 RUN mkdir /var/www/files && \
40 mkdir /var/www/db
41
42 # Create the Sqlite DB
43 RUN sqlite3 /var/www/db/uguuDB.sq3 -init /var/www/uguu/src/static/dbSchemas/sqlite_schema.sql "" && \
44 chown -R www-data:www-data /var/www && \
45 chmod -R 775 /var/www/
46
47 # Add scripts to cron
48 RUN echo "0,30 * * * * bash /var/www/uguu/src/static/scripts/checkfiles.sh" >> /var/spool/cron/crontabs/www-data && \
49 echo "0,30 * * * * bash /var/www/uguu/src/static/scripts/checkdb.sh" >> /var/spool/cron/crontabs/www-data
50
51 # Fix script paths
52 RUN chmod a+x /var/www/uguu/src/static/scripts/checkdb.sh && \
53 chmod a+x /var/www/uguu/src/static/scripts/checkfiles.sh && \
54 sed -i 's#/path/to/files/#/var/www/uguu/files/#g' /var/www/uguu/src/static/scripts/checkfiles.sh && \
55 sed -i 's#/path/to/db/uguu.sq3#/var/www/db/uguu.sq3#g' /var/www/uguu/src/static/scripts/checkdb.sh
56
57 # Copy Nginx Server conf
58 COPY docker/nginx/uguu.conf /etc/nginx/sites-enabled/uguu.conf
59
60 RUN sed -i "s#XMAINDOMAINX#${DOMAIN}#g" /etc/nginx/sites-enabled/uguu.conf
61 RUN sed -i "s#XFILESDOMAINX#${FILE_DOMAIN}#g" /etc/nginx/sites-enabled/uguu.conf
62
63 # Copy SSL certs
64 #COPY docker/ssl /etc/ssl
65
66 # Copy Uguu config
67 COPY src/config.json /var/www/uguu/config.json
68
69 # Expose port 80 from the container
70 EXPOSE 80
71
72 # Expose port 443 from the container
73 EXPOSE 443
74
75 #RUN service nginx restart
76 # Change user to www-data
77 #USER www-data
78
79 #RUN cd /var/www/uguu && make && make install
80
81 RUN curl -o acmeinstall.sh https://get.acme.sh
82 RUN chmod a+x acmeinstall.sh
83 RUN ./acmeinstall.sh
84 # Load entrypoint
85 ENTRYPOINT [ "bash", "/var/www/docker-entrypoint.sh" ]