Skip to content

Commit

Permalink
changes following review.
Browse files Browse the repository at this point in the history
  • Loading branch information
desaintmartin committed Nov 2, 2023
1 parent 3244a12 commit c78629b
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 68 deletions.
70 changes: 24 additions & 46 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,50 +1,28 @@
documentation
# Taken from .gitignore
/assets/.parcel-cache
/data/favicons/*.png
/data/favicons/*.jpg
/data/thumbnails/*.png
/data/thumbnails/*.jpg
/data/cache/*.spc
/data/logs/*.log
/data/sqlite/*.db
/public
docs/public/
docs/static/processed_images/
user.css
user.js
*.ini
node_modules
.env
vendor/
.php_cs.cache
__pycache__

# Regular docker ignore
.dockerignore
Dockerfile
.git
.git*
.github
.gitignore
*.md

# compiled output
/dist
/tmp
/out-tsc
# Only exists if Bazel was run
/bazel-out

# dependencies
/node_modules

# profiling files
chrome-profiler-events.json
speed-measure-plugin.json

# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# IDE - VSCode
.vscode/*
.history/*

# misc
/.sass-cache
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
yarn-error.log
testem.log
/typings

# System Files
.DS_Store
Thumbs.db

# testing
junit.xml
43 changes: 21 additions & 22 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# syntax=docker/dockerfile:1

### Stage 1: build client
FROM node:18 as client-builder
FROM node:20 as client-builder
WORKDIR /client-builder

# Install node packages
Expand All @@ -15,41 +17,38 @@ RUN npm run build

### Stage 2: final container
FROM php:8.2-apache
RUN apt-get update \
&& apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y cron unzip libjpeg62-turbo-dev libpng-dev libpq-dev libonig-dev libtidy-dev \
# Install package & php extensions, then clean-up dev package dependencies after
RUN export DEBIAN_FRONTEND=noninteractive \
&& apt update \
&& apt install -y --no-install-recommends \
unzip \
libjpeg62-turbo libpng16-16 libpq5 libonig5 libtidy5deb1 \
libjpeg62-turbo-dev libpng-dev libpq-dev libonig-dev libtidy-dev \
&& update-ca-certificates --fresh \
&& docker-php-ext-configure gd --with-jpeg \
&& docker-php-ext-install gd mbstring pdo_pgsql pdo_mysql tidy \
&& apt remove -y libjpeg62-turbo-dev libpng-dev libpq-dev libonig-dev libtidy-dev \
&& apt autoremove -y \
&& apt clean \
&& rm -rf /var/lib/apt/lists/*

RUN docker-php-ext-configure gd \
&& docker-php-ext-install gd mbstring pdo_pgsql pdo_mysql tidy

# Install Apache modules
RUN a2enmod headers rewrite

RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \
&& php composer-setup.php \
&& php -r "unlink('composer-setup.php');" \
&& mv composer.phar /usr/local/bin/composer

# Install dependencies
# Install Selfoss PHP dependencies
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
COPY composer.json .
COPY composer.lock .
RUN COMPOSER_ALLOW_SUPERUSER=1 composer install --optimize-autoloader --no-dev
RUN rm /usr/bin/composer

# Setup cron
RUN echo '* * * * * curl http://localhost/update' | tee /etc/cron.d/selfoss \
&& chmod 0644 /etc/cron.d/selfoss \
&& crontab /etc/cron.d/selfoss

# Install Selfoss and copy frontend from the first stage
WORKDIR /var/www/html

COPY . .

COPY --from=client-builder /client-builder/public /var/www/html/public

# Use www-data user as owner and drop root user
RUN chown -R www-data:www-data /var/www/html/data

# Overload default command to run cron in the background
RUN sed -i 's/^exec /service cron start\n\nexec /' /usr/local/bin/apache2-foreground
USER www-data

VOLUME /var/www/html/data

0 comments on commit c78629b

Please sign in to comment.