-
Notifications
You must be signed in to change notification settings - Fork 345
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(docker): add basic docker support
- Loading branch information
1 parent
e0c9805
commit 3244a12
Showing
2 changed files
with
105 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
documentation | ||
.dockerignore | ||
Dockerfile | ||
.git | ||
.git* | ||
*.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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
### Stage 1: build client | ||
FROM node:18 as client-builder | ||
WORKDIR /client-builder | ||
|
||
# Install node packages | ||
COPY package.json . | ||
COPY client/package.json client/ | ||
COPY client/package-lock.json client/ | ||
RUN npm run install-dependencies:client | ||
|
||
# Build client | ||
COPY client/ client/ | ||
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 \ | ||
&& update-ca-certificates --fresh \ | ||
&& 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 | ||
|
||
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 | ||
COPY composer.json . | ||
COPY composer.lock . | ||
RUN COMPOSER_ALLOW_SUPERUSER=1 composer install --optimize-autoloader --no-dev | ||
|
||
# Setup cron | ||
RUN echo '* * * * * curl http://localhost/update' | tee /etc/cron.d/selfoss \ | ||
&& chmod 0644 /etc/cron.d/selfoss \ | ||
&& crontab /etc/cron.d/selfoss | ||
|
||
WORKDIR /var/www/html | ||
|
||
COPY . . | ||
|
||
COPY --from=client-builder /client-builder/public /var/www/html/public | ||
|
||
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 | ||
|
||
VOLUME /var/www/html/data |