]> jfr.im git - uguu.git/blobdiff - docker/Dockerfile
fix
[uguu.git] / docker / Dockerfile
index bf9cfb9439965ebb50aeff9ed20cfa3736392bf5..4ec2ea8972841b57c72c2a9d8dbdf450de129f76 100644 (file)
@@ -1,67 +1,85 @@
-FROM alpine:latest
-
-ARG VERSION
-
-# Install the needed software
-RUN apk add --no-cache curl nginx php8-fpm php8-sqlite3 php8-opcache sqlite nodejs git npm bash build-base supervisor
-
-# Create the www-data user and group
-RUN set -x ; \
-  addgroup -g 82 -S www-data ; \
-  adduser -u 82 -D -S -G www-data www-data && exit 0 ; exit 1
-
-# Link php bin
-RUN ln -s /usr/bin/php8 /usr/bin/php
-
-# Copy supervisor conf file
-COPY docker/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
+FROM --platform=linux/amd64 debian:bullseye-slim
+
+# Install needed software
+RUN apt-get update
+
+RUN apt-get install -y lsb-release ca-certificates apt-transport-https software-properties-common gnupg2 curl cron socat
+RUN echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/sury-php.list
+RUN curl -fsSL  https://packages.sury.org/php/apt.gpg| gpg --dearmor -o /etc/apt/trusted.gpg.d/sury-keyring.gpg
+RUN apt-get update
+RUN apt-get upgrade -y
+RUN curl -o nodejssetup.sh https://deb.nodesource.com/setup_19.x
+RUN chmod a+x nodejssetup.sh
+RUN ./nodejssetup.sh
+RUN apt-get install -y nodejs gcc g++ make
+RUN apt-get install -y build-essential nginx-full php8.1-fpm php8.1 sqlite3 php8.1-sqlite3 \
+                       php8.1-curl php8.1-cli php8.1-lz4 \
+                       php8.1-mcrypt php8.1-mysql php8.1-xdebug php8.1-zip \
+                       php8.1-common php8.1-readline php8.1-bcmath php8.1-common php8.1-xml
+
+
+ARG DOMAIN
+ENV DOMAIN=$DOMAIN
+ARG FILE_DOMAIN
+ENV FILE_DOMAIN=$FILE_DOMAIN
+ARG CONTACT_EMAIL
+ENV CONTACT_EMAIL=$CONTACT_EMAIL
 
 # Set default workdir
 WORKDIR  /var/www/
 
 COPY docker/docker-entrypoint.sh .
 
-# Download Uguu
-ADD https://git.pomf.se/Pomf/uguu/archive/v${VERSION}.tar.gz v${VERSION}.tar.gz
-RUN tar xvf v${VERSION}.tar.gz
+# Decompress into Docker
+COPY docker/uguuForDocker.tar.gz /var/www/
+RUN mkdir /var/www/uguu
+RUN tar -xvf uguuForDocker.tar.gz -C uguu
 
 # Create the needed directories
-RUN mkdir /var/www/uguu/dist && \
-    mkdir /var/www/db && \
-    mkdir /var/www/files
+RUN mkdir /var/www/files && \
+    mkdir /var/www/db
 
 # Create the Sqlite DB
-RUN sqlite3 /var/www/db/uguu.sq3 -init /var/www/uguu/sqlite_schema.sql && \
+RUN sqlite3 /var/www/db/uguuDB.sq3 -init /var/www/uguu/src/static/dbSchemas/sqlite_schema.sql "" && \
     chown -R www-data:www-data /var/www && \
     chmod -R 775 /var/www/
 
-# Fix script paths
-RUN chmod a+x /var/www/uguu/checkdb.sh && \
-    chmod a+x /var/www/uguu/checkfiles.sh && \
-    sed -i 's#/path/to/files/#/var/www/uguu/files/#g' /var/www/uguu/checkfiles.sh && \
-    sed -i 's#/path/to/db/uguu.sq3#/var/www/db/uguu.sq3#g' /var/www/uguu/checkdb.sh
-
 # Add scripts to cron
-RUN echo "0,30 * * * * bash /var/www/uguu/checkfiles.sh" >> /var/spool/cron/crontabs/www-data && \
-    echo "0,30 * * * * bash /var/www/uguu/checkdb.sh" >> /var/spool/cron/crontabs/www-data
+RUN echo "0,30 * * * * bash /var/www/uguu/src/static/scripts/checkfiles.sh" >> /var/spool/cron/crontabs/www-data && \
+    echo "0,30 * * * * bash /var/www/uguu/src/static/scripts/checkdb.sh" >> /var/spool/cron/crontabs/www-data
+
+# Fix script paths
+RUN chmod a+x /var/www/uguu/src/static/scripts/checkdb.sh && \
+    chmod a+x /var/www/uguu/src/static/scripts/checkfiles.sh && \
+    sed -i 's#/path/to/files/#/var/www/uguu/files/#g' /var/www/uguu/src/static/scripts/checkfiles.sh && \
+    sed -i 's#/path/to/db/uguu.sq3#/var/www/db/uguu.sq3#g' /var/www/uguu/src/static/scripts/checkdb.sh
 
 # Copy Nginx Server conf
-COPY docker/uguu.conf /etc/nginx/http.d/
+COPY docker/nginx/uguu.conf /etc/nginx/sites-enabled/uguu.conf
+
+RUN sed -i "s#XMAINDOMAINX#${DOMAIN}#g" /etc/nginx/sites-enabled/uguu.conf
+RUN sed -i "s#XFILESDOMAINX#${FILE_DOMAIN}#g" /etc/nginx/sites-enabled/uguu.conf
 
 # Copy SSL certs
-COPY docker/ssl /etc/ssl
+#COPY docker/ssl /etc/ssl
 
 # Copy Uguu config
-COPY dist.json /var/www/uguu/dist.json
+COPY src/config.json /var/www/uguu/config.json
 
-# Give permissions to www-data
-RUN chown -R www-data:www-data /run /var/lib/php8 /var/lib/nginx /var/log/nginx /var/log/php8 /etc/nginx /etc/php8
+# Expose port 80 from the container
+EXPOSE 80
 
+# Expose port 443 from the container
+EXPOSE 443
+
+#RUN service nginx restart
 # Change user to www-data
-USER www-data
+#USER www-data
 
-# Expose port 80 from the container
-EXPOSE 80
+#RUN cd /var/www/uguu && make && make install
 
+RUN curl -o acmeinstall.sh https://get.acme.sh
+RUN chmod a+x acmeinstall.sh
+RUN ./acmeinstall.sh
 # Load entrypoint
 ENTRYPOINT [ "bash", "/var/www/docker-entrypoint.sh" ]
\ No newline at end of file