]> jfr.im git - uguu.git/blame - docker/Dockerfile
fix multiple uploads in same request
[uguu.git] / docker / Dockerfile
CommitLineData
af4b9c42
GJ
1FROM --platform=linux/amd64 debian:bullseye-slim
2
3# Install needed software
4RUN apt-get update
af4b9c42
GJ
5RUN apt-get install -y lsb-release ca-certificates apt-transport-https software-properties-common gnupg2 curl cron socat
6RUN echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/sury-php.list
7RUN curl -fsSL https://packages.sury.org/php/apt.gpg| gpg --dearmor -o /etc/apt/trusted.gpg.d/sury-keyring.gpg
8RUN apt-get update
9RUN apt-get upgrade -y
10RUN curl -o nodejssetup.sh https://deb.nodesource.com/setup_19.x
11RUN chmod a+x nodejssetup.sh
12RUN ./nodejssetup.sh
13RUN apt-get install -y nodejs gcc g++ make
14RUN apt-get install -y build-essential nginx-full php8.1-fpm php8.1 sqlite3 php8.1-sqlite3 \
52053519 15 php8.1-curl php8.1-cli php8.1-lz4 php8.1-pgsql \
af4b9c42
GJ
16 php8.1-mcrypt php8.1-mysql php8.1-xdebug php8.1-zip \
17 php8.1-common php8.1-readline php8.1-bcmath php8.1-common php8.1-xml
b3c0237a 18
7d787da8 19# Set ENV values for configuration
7f8963f6
GJ
20ARG DOMAIN
21ENV DOMAIN=$DOMAIN
3b940afe 22
7f8963f6
GJ
23ARG FILE_DOMAIN
24ENV FILE_DOMAIN=$FILE_DOMAIN
3b940afe 25
7f8963f6
GJ
26ARG CONTACT_EMAIL
27ENV CONTACT_EMAIL=$CONTACT_EMAIL
3b940afe 28
f7f02b92
GJ
29ARG MAX_SIZE
30ENV MAX_SIZE=$MAX_SIZE
7f8963f6 31
3b940afe
GJ
32ARG EXPIRE_TIME
33ENV EXPIRE_TIME=$EXPIRE_TIME
34
b3c0237a 35# Set default workdir
0a6585a2 36WORKDIR /var/www/
37
38COPY docker/docker-entrypoint.sh .
39
e480c0e5
GJ
40# Decompress into Docker
41COPY docker/uguuForDocker.tar.gz /var/www/
42RUN mkdir /var/www/uguu
43RUN tar -xvf uguuForDocker.tar.gz -C uguu
0a6585a2 44
b3c0237a 45# Create the needed directories
e480c0e5
GJ
46RUN mkdir /var/www/files && \
47 mkdir /var/www/db
fca51030 48
b3c0237a 49# Create the Sqlite DB
56648f56 50RUN sqlite3 /var/www/db/uguu.sq3 -init /var/www/uguu/src/static/dbSchemas/sqlite_schema.sql "" && \
b3c0237a 51 chown -R www-data:www-data /var/www && \
0a6585a2 52 chmod -R 775 /var/www/
53
af4b9c42
GJ
54# Add scripts to cron
55RUN echo "0,30 * * * * bash /var/www/uguu/src/static/scripts/checkfiles.sh" >> /var/spool/cron/crontabs/www-data && \
56 echo "0,30 * * * * bash /var/www/uguu/src/static/scripts/checkdb.sh" >> /var/spool/cron/crontabs/www-data
57
b3c0237a 58# Fix script paths
e480c0e5
GJ
59RUN chmod a+x /var/www/uguu/src/static/scripts/checkdb.sh && \
60 chmod a+x /var/www/uguu/src/static/scripts/checkfiles.sh && \
61 sed -i 's#/path/to/files/#/var/www/uguu/files/#g' /var/www/uguu/src/static/scripts/checkfiles.sh && \
62 sed -i 's#/path/to/db/uguu.sq3#/var/www/db/uguu.sq3#g' /var/www/uguu/src/static/scripts/checkdb.sh
0a6585a2 63
b3c0237a 64# Copy Nginx Server conf
af4b9c42 65COPY docker/nginx/uguu.conf /etc/nginx/sites-enabled/uguu.conf
f7f02b92 66COPY docker/nginx/nginx.conf /etc/nginx/nginx.conf
b3c0237a 67
3b940afe
GJ
68# Modify expire time
69RUN sed -i "s#XXX#${EXPIRE_TIME}#g" /var/www/uguu/src/static/scripts/checkfiles.sh
70RUN sed -i "s#XXX#${EXPIRE_TIME}#g" /var/www/uguu/src/static/scripts/checkdb.sh
71
f7f02b92 72# Modify nginx values
7f8963f6
GJ
73RUN sed -i "s#XMAINDOMAINX#${DOMAIN}#g" /etc/nginx/sites-enabled/uguu.conf
74RUN sed -i "s#XFILESDOMAINX#${FILE_DOMAIN}#g" /etc/nginx/sites-enabled/uguu.conf
8e96eafc 75RUN sed -i "s#client_max_body_size 128M#client_max_body_size ${MAX_SIZE}M#g" /etc/nginx/nginx.conf
b3c0237a 76
f7f02b92
GJ
77# Modify php-fpm values
78RUN sed -i "s#post_max_size = 8M#post_max_size = ${MAX_SIZE}M#g" /etc/php/8.1/fpm/php.ini
79RUN sed -i "s#upload_max_filesize = 2M#upload_max_filesize = ${MAX_SIZE}M#g" /etc/php/8.1/fpm/php.ini
e480c0e5 80
b3c0237a 81# Copy Uguu config
e480c0e5 82COPY src/config.json /var/www/uguu/config.json
b3c0237a 83
b3c0237a 84# Expose port 80 from the container
0a6585a2 85EXPOSE 80
86
ccf3370a
GJ
87# Expose port 443 from the container
88EXPOSE 443
89
7d787da8 90# Install acme.sh
af4b9c42
GJ
91RUN curl -o acmeinstall.sh https://get.acme.sh
92RUN chmod a+x acmeinstall.sh
93RUN ./acmeinstall.sh
7d787da8 94
b3c0237a 95# Load entrypoint
56648f56 96ENTRYPOINT [ "bash", "/var/www/docker-entrypoint.sh" ]