Skip to content

Commit f7eab63

Browse files
committed
changes following review.
1 parent 3244a12 commit f7eab63

File tree

2 files changed

+45
-68
lines changed

2 files changed

+45
-68
lines changed

.dockerignore

+24-46
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,28 @@
1-
documentation
1+
# Taken from .gitignore
2+
/assets/.parcel-cache
3+
/data/favicons/*.png
4+
/data/favicons/*.jpg
5+
/data/thumbnails/*.png
6+
/data/thumbnails/*.jpg
7+
/data/cache/*.spc
8+
/data/logs/*.log
9+
/data/sqlite/*.db
10+
/public
11+
docs/public/
12+
docs/static/processed_images/
13+
user.css
14+
user.js
15+
*.ini
16+
node_modules
17+
.env
18+
vendor/
19+
.php_cs.cache
20+
__pycache__
21+
22+
# Regular docker ignore
223
.dockerignore
324
Dockerfile
425
.git
5-
.git*
26+
.github
27+
.gitignore
628
*.md
7-
8-
# compiled output
9-
/dist
10-
/tmp
11-
/out-tsc
12-
# Only exists if Bazel was run
13-
/bazel-out
14-
15-
# dependencies
16-
/node_modules
17-
18-
# profiling files
19-
chrome-profiler-events.json
20-
speed-measure-plugin.json
21-
22-
# IDEs and editors
23-
/.idea
24-
.project
25-
.classpath
26-
.c9/
27-
*.launch
28-
.settings/
29-
*.sublime-workspace
30-
31-
# IDE - VSCode
32-
.vscode/*
33-
.history/*
34-
35-
# misc
36-
/.sass-cache
37-
/connect.lock
38-
/coverage
39-
/libpeerconnection.log
40-
npm-debug.log
41-
yarn-error.log
42-
testem.log
43-
/typings
44-
45-
# System Files
46-
.DS_Store
47-
Thumbs.db
48-
49-
# testing
50-
junit.xml

Dockerfile

+21-22
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
# syntax=docker/dockerfile:1
2+
13
### Stage 1: build client
2-
FROM node:18 as client-builder
4+
FROM node:20 as client-builder
35
WORKDIR /client-builder
46

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

1618
### Stage 2: final container
1719
FROM php:8.2-apache
18-
RUN apt-get update \
19-
&& 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 \
20+
# Install package & php dependencies, clean-up dev package dependencies after
21+
RUN export DEBIAN_FRONTEND=noninteractive \
22+
&& apt update \
23+
&& apt install -y --no-install-recommends \
24+
unzip \
25+
libjpeg62-turbo libpng16-16 libpq5 libonig5 libtidy5deb1 \
26+
libjpeg62-turbo-dev libpng-dev libpq-dev libonig-dev libtidy-dev \
2027
&& update-ca-certificates --fresh \
28+
&& docker-php-ext-configure gd --with-jpeg \
29+
&& docker-php-ext-install gd mbstring pdo_pgsql pdo_mysql tidy \
30+
&& apt remove -y libjpeg62-turbo-dev libpng-dev libpq-dev libonig-dev libtidy-dev \
31+
&& apt autoremove -y \
2132
&& apt clean \
2233
&& rm -rf /var/lib/apt/lists/*
2334

24-
RUN docker-php-ext-configure gd \
25-
&& docker-php-ext-install gd mbstring pdo_pgsql pdo_mysql tidy
26-
35+
# Install Apache modules
2736
RUN a2enmod headers rewrite
2837

29-
RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \
30-
&& php composer-setup.php \
31-
&& php -r "unlink('composer-setup.php');" \
32-
&& mv composer.phar /usr/local/bin/composer
33-
34-
# Install dependencies
38+
# Install PHP dependencies
39+
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
3540
COPY composer.json .
3641
COPY composer.lock .
3742
RUN COMPOSER_ALLOW_SUPERUSER=1 composer install --optimize-autoloader --no-dev
43+
RUN rm /usr/bin/composer
3844

39-
# Setup cron
40-
RUN echo '* * * * * curl http://localhost/update' | tee /etc/cron.d/selfoss \
41-
&& chmod 0644 /etc/cron.d/selfoss \
42-
&& crontab /etc/cron.d/selfoss
43-
45+
# Install selfoss, copy frontend from the first stage
4446
WORKDIR /var/www/html
45-
4647
COPY . .
47-
4848
COPY --from=client-builder /client-builder/public /var/www/html/public
4949

50+
# Use www-data user as owner and drop root user
5051
RUN chown -R www-data:www-data /var/www/html/data
51-
52-
# Overload default command to run cron in the background
53-
RUN sed -i 's/^exec /service cron start\n\nexec /' /usr/local/bin/apache2-foreground
52+
USER www-data
5453

5554
VOLUME /var/www/html/data

0 commit comments

Comments
 (0)