Skip to content

Commit 3244a12

Browse files
committed
feat(docker): add basic docker support
1 parent e0c9805 commit 3244a12

File tree

2 files changed

+105
-0
lines changed

2 files changed

+105
-0
lines changed

.dockerignore

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
documentation
2+
.dockerignore
3+
Dockerfile
4+
.git
5+
.git*
6+
*.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

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
### Stage 1: build client
2+
FROM node:18 as client-builder
3+
WORKDIR /client-builder
4+
5+
# Install node packages
6+
COPY package.json .
7+
COPY client/package.json client/
8+
COPY client/package-lock.json client/
9+
RUN npm run install-dependencies:client
10+
11+
# Build client
12+
COPY client/ client/
13+
RUN npm run build
14+
15+
16+
### Stage 2: final container
17+
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+
&& update-ca-certificates --fresh \
21+
&& apt clean \
22+
&& rm -rf /var/lib/apt/lists/*
23+
24+
RUN docker-php-ext-configure gd \
25+
&& docker-php-ext-install gd mbstring pdo_pgsql pdo_mysql tidy
26+
27+
RUN a2enmod headers rewrite
28+
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
35+
COPY composer.json .
36+
COPY composer.lock .
37+
RUN COMPOSER_ALLOW_SUPERUSER=1 composer install --optimize-autoloader --no-dev
38+
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+
44+
WORKDIR /var/www/html
45+
46+
COPY . .
47+
48+
COPY --from=client-builder /client-builder/public /var/www/html/public
49+
50+
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
54+
55+
VOLUME /var/www/html/data

0 commit comments

Comments
 (0)