Update 'docker/Dockerfile'
This commit is contained in:
parent
9650e66147
commit
4717c93610
1 changed files with 44 additions and 19 deletions
|
@ -1,42 +1,67 @@
|
|||
FROM ubuntu:latest
|
||||
FROM alpine:latest
|
||||
|
||||
ARG VERSION
|
||||
|
||||
RUN apt-get update && \
|
||||
apt install -y software-properties-common && \
|
||||
add-apt-repository ppa:ondrej/php && \
|
||||
apt-get install -y build-essential nginx-full php8.0-fpm php8.0 sqlite3 php8.0-sqlite3 nodejs certbot git npm cron gettext-base && \
|
||||
apt clean
|
||||
# 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
|
||||
|
||||
# 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
|
||||
|
||||
RUN tar xvf v${VERSION}.tar.gz && \
|
||||
mv Uguu-${VERSION}/ uguu
|
||||
|
||||
# Create the needed directories
|
||||
RUN mkdir /var/www/uguu/dist && \
|
||||
mkdir /var/www/db && \
|
||||
mkdir /var/www/files
|
||||
|
||||
# Create the Sqlite DB
|
||||
RUN sqlite3 /var/www/db/uguu.sq3 -init /var/www/uguu/sqlite_schema.sql && \
|
||||
chown -R www-data:www-data /var/www/db /var/www/files && \
|
||||
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
|
||||
|
||||
RUN echo "0,30 * * * * bash /var/www/uguu/checkfiles.sh" >> /var/spool/cron/crontabs/root && \
|
||||
echo "0,30 * * * * bash /var/www/uguu/checkdb.sh" >> /var/spool/cron/crontabs/root
|
||||
# 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
|
||||
|
||||
COPY docker/uguu.conf /etc/nginx/conf.d/
|
||||
# Copy Nginx Server conf
|
||||
COPY docker/uguu.conf /etc/nginx/http.d/
|
||||
|
||||
COPY dist.json /var/www/uguu/_dist.json
|
||||
# Copy SSL certs
|
||||
COPY docker/ssl /etc/ssl
|
||||
|
||||
# Copy Uguu config
|
||||
COPY dist.json /var/www/uguu/dist.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
|
||||
|
||||
# Change user to www-data
|
||||
USER www-data
|
||||
|
||||
# Expose port 80 from the container
|
||||
EXPOSE 80
|
||||
|
||||
# Load entrypoint
|
||||
ENTRYPOINT [ "bash", "/var/www/docker-entrypoint.sh" ]
|
Loading…
Reference in a new issue