Skip to content

Commit 2910891

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

File tree

2 files changed

+46
-68
lines changed

2 files changed

+46
-68
lines changed

.dockerignore

Lines changed: 24 additions & 46 deletions
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

Lines changed: 22 additions & 22 deletions
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,39 @@ 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 runtime & development package dependencies & php extensions
21+
# then clean-up dev package dependencies
22+
RUN export DEBIAN_FRONTEND=noninteractive \
23+
&& apt update \
24+
&& apt install -y --no-install-recommends \
25+
unzip \
26+
libjpeg62-turbo libpng16-16 libpq5 libonig5 libtidy5deb1 \
27+
libjpeg62-turbo-dev libpng-dev libpq-dev libonig-dev libtidy-dev \
2028
&& update-ca-certificates --fresh \
29+
&& docker-php-ext-configure gd --with-jpeg \
30+
&& docker-php-ext-install gd mbstring pdo_pgsql pdo_mysql tidy \
31+
&& apt remove -y libjpeg62-turbo-dev libpng-dev libpq-dev libonig-dev libtidy-dev \
32+
&& apt autoremove -y \
2133
&& apt clean \
2234
&& rm -rf /var/lib/apt/lists/*
2335

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

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
39+
# Install Selfoss PHP dependencies
40+
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
3541
COPY composer.json .
3642
COPY composer.lock .
3743
RUN COMPOSER_ALLOW_SUPERUSER=1 composer install --optimize-autoloader --no-dev
44+
RUN rm /usr/bin/composer
3845

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-
46+
# Install Selfoss and copy frontend from the first stage
4447
WORKDIR /var/www/html
45-
4648
COPY . .
47-
4849
COPY --from=client-builder /client-builder/public /var/www/html/public
4950

51+
# Use www-data user as owner and drop root user
5052
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
53+
USER www-data
5454

5555
VOLUME /var/www/html/data

0 commit comments

Comments
 (0)