Docker setup

This commit is contained in:
Andreas Palm 2024-03-21 22:28:00 +01:00
parent 83f8f61174
commit 2baab98261
5 changed files with 105 additions and 0 deletions

6
.dockerignore Normal file
View File

@ -0,0 +1,6 @@
database
node_modules
www/cache
www/dist
userdata
!userdata/wiki

2
.gitignore vendored
View File

@ -4,3 +4,5 @@ userdata
www/cache/
node_modules/
www/themes/new/css/custom.css
docker-compose.override.yml
.idea

View File

@ -0,0 +1,8 @@
# This file can be used to override defaults from the docker-compose.yml file
# if it is copied/renamed to docker-compose.override.yml
version: '3.9'
services:
vite:
# Set this to your local uid:gid to run the frontend build as your user and keep the working directory clean
user: 1000:1000

62
docker-compose.yml Normal file
View File

@ -0,0 +1,62 @@
version: '3.9'
services:
vite:
build:
context: .
dockerfile: docker/Dockerfile
target: frontend
image: openxe_frontend
entrypoint: npm run dev
volumes:
- .:/app
ports:
- "5173:5173"
app_init:
image: openxe:test
volumes:
- .:/var/www/html
working_dir: /var/www/html/upgrade
entrypoint: php data/upgrade.php -db -do
depends_on:
mysql:
condition: service_healthy
app:
build:
context: .
dockerfile: docker/Dockerfile
image: openxe:test
volumes:
- .:/var/www/html
ports:
- "8081:80"
depends_on:
app_init:
condition: service_completed_successfully
mysql:
condition: service_healthy
mysql:
image: mariadb:10.11
environment:
MYSQL_ROOT_PASSWORD: "rootpw"
MYSQL_USER: "openxe"
MYSQL_PASSWORD: "openxe"
MYSQL_DATABASE: "openxe"
MARIADB_AUTO_UPGRADE: "1"
volumes:
- mysqldata:/var/lib/mysql
ports:
- "3306:3306"
healthcheck:
interval: 5s
retries: 3
test:
[
"CMD",
"healthcheck.sh",
"--connect",
"--innodb_initialized"
]
timeout: 30s
volumes:
mysqldata: {}

27
docker/Dockerfile Normal file
View File

@ -0,0 +1,27 @@
ARG PHP_EXT="gd ldap imap mysqli soap zip"
ARG DEB_PKG="libc-client2007e libaom3 libavif15 libdav1d6 libfreetype6 libjpeg62-turbo libldap-common libpng16-16 libwebp7 libxpm4 libzip4"
ARG DEB_PKG_TMP="cmake gnutls-dev libaom-dev libavif-dev libbz2-dev libc-client-dev libdav1d-dev libfreetype6-dev libjpeg62-turbo-dev libkrb5-dev libldap2-dev libpng-dev libssl-dev libwebp-dev libxml2-dev libxpm-dev libzip-dev zlib1g-dev"
FROM node:20 as frontend
WORKDIR /app
COPY package.json package-lock.json vite.config.js /app/
RUN npm install
COPY classes /app/classes
COPY resources /app/resources
COPY www /app/www
RUN npm run build
#FROM php:8.1-fpm as fpm_server
FROM php:8.1-apache as web_server
ARG PHP_EXT
ARG DEB_PKG
ARG DEB_PKG_TMP
WORKDIR /app
RUN apt-get update && apt-get install -y ${DEB_PKG} ${DEB_PKG_TMP} && \
docker-php-ext-configure imap --with-kerberos --with-imap-ssl && \
docker-php-ext-install ${PHP_EXT} && \
apt-get remove --purge -y ${DEB_PKG_TMP}
COPY --chown=www-data:www-data . /var/www/html
COPY --chown=www-data:www-data --from=frontend /app/www/dist /var/www/html/www/dist