diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..c7688ce --- /dev/null +++ b/.dockerignore @@ -0,0 +1,5 @@ +.git +.gitignore +.dockerignore +node_modules + diff --git a/CHANGELOG b/CHANGELOG new file mode 100644 index 0000000..0b6ac06 --- /dev/null +++ b/CHANGELOG @@ -0,0 +1,2 @@ +[0.1.0] +* Initial version diff --git a/CloudronManifest.json b/CloudronManifest.json new file mode 100644 index 0000000..521d0c2 --- /dev/null +++ b/CloudronManifest.json @@ -0,0 +1,22 @@ +{ + "id": "org.firefly-iii.coudronapp", + "title": "Firefly III", + "author": "Firefly developers", + "description": "file://DESCRIPTION.md", + "changelog": "file://CHANGELOG", + "tagline": "A personal finances manager", + "version": "4.7.8", + "healthCheckPath": "/", + "httpPort": 3000, + "addons": { + "localstorage": {} + }, + "manifestVersion": 1, + "website": "https://firefly-iii.org/", + "contactEmail": "thegrumpydictator@gmail.com", + "icon": "", + "tags": [ + "changeme" + ], + "mediaLinks": [ ] +} diff --git a/DESCRIPTION.md b/DESCRIPTION.md new file mode 100644 index 0000000..ee63036 --- /dev/null +++ b/DESCRIPTION.md @@ -0,0 +1 @@ +Please add the appstore description in markdown format here. \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..69d5324 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,88 @@ +FROM cloudron/base:1.0.0@sha256:147a648a068a2e746644746bbfb42eb7a50d682437cead3c67c933c546357617 + +# Many lines are copied from https://github.com/firefly-iii/firefly-iii/blob/master/Dockerfile + +ENV FIREFLY_VERSION 4.7.8 +ENV FIREFLY_PATH /app/code +ENV CURL_VERSION 7.60.0 +ENV OPENSSL_VERSION 1.1.1-pre6 +ENV COMPOSER_ALLOW_SUPERUSER 1 + +LABEL version="1.0" maintainer="robomod@xeac.org" + +## Prepare third parties +# Install packages +RUN apt-get update -y && \ + apt-get install -y --no-install-recommends libjpeg62-turbo-dev \ + libpng-dev \ + libldap2-dev \ + libedit-dev \ + libtidy-dev \ + libsqlite3-dev \ + libbz2-dev \ + cron \ + rsyslog \ + locales && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* + +# LDAP install +RUN docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ && docker-php-ext-install ldap + +# Install latest curl +RUN cd /tmp && \ + wget https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz && \ + tar -xvf openssl-${OPENSSL_VERSION}.tar.gz && \ + cd openssl-${OPENSSL_VERSION} && \ + ./config && \ + make -j${CORES} && \ + make install + +RUN cd /tmp && \ + wget https://curl.haxx.se/download/curl-${CURL_VERSION}.tar.gz && \ + tar -xvf curl-${CURL_VERSION}.tar.gz && \ + cd curl-${CURL_VERSION} && \ + ./configure --with-ssl --host=$(gcc -dumpmachine) && \ + make -j${CORES} && \ + make install + +# Make sure that libcurl is using the newer curl libaries +RUN echo "/usr/local/lib" >> /etc/ld.so.conf.d/00-curl.conf && ldconfig + +# Fix the link to curl: +RUN rm -rf /usr/local/lib/libcurl.so.4 && ln -s /usr/lib/x86_64-linux-gnu/libcurl.so.4.4.0 /usr/local/lib/libcurl.so.4 + +## Configure system +# Generate locales supported by Firefly III +RUN echo "en_US.UTF-8 UTF-8\nde_DE.UTF-8 UTF-8\nfr_FR.UTF-8 UTF-8\nit_IT.UTF-8 UTF-8\nnl_NL.UTF-8 UTF-8\npl_PL.UTF-8 UTF-8\npt_BR.UTF-8 UTF-8\nru_RU.UTF-8 UTF-8\ntr_TR.UTF-8 UTF-8\n\n" > /etc/locale.gen && locale-gen + +# Supervisor conf +ADD supervisor/ /etc/supervisor/conf.d/ + +# Enable apache mod rewrite and ssl +RUN a2enmod rewrite +RUN a2enmod ssl + +# Firefly apache conf +ADD apache-firefly.conf /etc/apache2/sites-available/000-default.conf + +# Start script +ADD start.sh /app/code/start.sh + +## Install software +# Create app code directory +RUN mkdir -p /app/code +WORKDIR /app/code + +# Get Firefly +RUN wget "https://github.com/firefly-iii/firefly-iii/archive/${FIREFLY_VERSION}.tar.gz" -O - \ + | tar -xz -C /app/code --strip-components=1 + +# Run composer +RUN composer install --prefer-dist --no-dev --no-scripts --no-suggest + +# Expose port +EXPOSE 3000 + +# Run start script +CMD [ "/app/code/start.sh" ] diff --git a/apache-firefly.conf b/apache-firefly.conf new file mode 100644 index 0000000..1233b7f --- /dev/null +++ b/apache-firefly.conf @@ -0,0 +1,14 @@ + + ServerAdmin webmaster@localhost + DocumentRoot /app/code + + ErrorLog "|/bin/cat" + CustomLog "|/bin/cat" combined + + + Options -Indexes +FollowSymLinks + AllowOverride All + Order allow,deny + allow from all + + diff --git a/start.sh b/start.sh new file mode 100755 index 0000000..ff808c1 --- /dev/null +++ b/start.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +# make sure the correct directories exists (suggested by @chrif): +mkdir -p $FIREFLY_PATH/storage/app +mkdir -p $FIREFLY_PATH/storage/app/public +mkdir -p $FIREFLY_PATH/storage/build +mkdir -p $FIREFLY_PATH/storage/database +mkdir -p $FIREFLY_PATH/storage/debugbar +mkdir -p $FIREFLY_PATH/storage/export +mkdir -p $FIREFLY_PATH/storage/framework/cache +mkdir -p $FIREFLY_PATH/storage/framework/sessions +mkdir -p $FIREFLY_PATH/storage/framework/testing +mkdir -p $FIREFLY_PATH/storage/framework/views +mkdir -p $FIREFLY_PATH/storage/logs +mkdir -p $FIREFLY_PATH/storage/upload + + +# make sure we own the volumes: +chown -R www-data:www-data -R $FIREFLY_PATH/storage +chmod -R 775 $FIREFLY_PATH/storage + +# remove any lingering files that may break upgrades: +rm -f $FIREFLY_PATH/storage/logs/laravel.log + +cat .env.docker | envsubst > .env +composer dump-autoload +php artisan package:discover +php artisan firefly:instructions install +exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf --nodaemon \ No newline at end of file diff --git a/supervisor/cronjob.conf b/supervisor/cronjob.conf new file mode 100644 index 0000000..71aacd8 --- /dev/null +++ b/supervisor/cronjob.conf @@ -0,0 +1,11 @@ +[program:cron] +command=/usr/sbin/cron -f -L 15 +user=root +autostart=true +autorestart=true +stdout_events_enabled=true +stderr_events_enabled=true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +startsecs=10 +startretries=3 diff --git a/supervisor/firefly-iii.conf b/supervisor/firefly-iii.conf new file mode 100644 index 0000000..5ee1c2e --- /dev/null +++ b/supervisor/firefly-iii.conf @@ -0,0 +1,6 @@ +[program:apache2] +command=/bin/bash -c "source /etc/apache2/envvars && exec /usr/sbin/apache2 -DFOREGROUND" +stdout_events_enabled=true +stderr_events_enabled=true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 \ No newline at end of file