Skip to content

Commit

Permalink
feat(docker): add basic docker support.
Browse files Browse the repository at this point in the history
  • Loading branch information
desaintmartin committed May 29, 2023
1 parent 2a89be5 commit d60c127
Show file tree
Hide file tree
Showing 2 changed files with 105 additions and 0 deletions.
50 changes: 50 additions & 0 deletions .dockerignore
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
55 changes: 55 additions & 0 deletions Dockerfile
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

0 comments on commit d60c127

Please sign in to comment.