Created
April 12, 2023 08:31
-
-
Save cbebry/f7b6e118e23a7c4cdd77dbc74eb7c484 to your computer and use it in GitHub Desktop.
Matomo docker basics
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
version: '3' | |
services: | |
web: | |
build: | |
context: . | |
dockerfile: Dockerfile-web | |
ports: | |
- "80:80" | |
volumes: | |
- ./matomo:/var/www/html | |
environment: | |
DB_HOST: db | |
DB_PORT: 3306 | |
DB_DATABASE: my_database | |
DB_USERNAME: my_username | |
DB_PASSWORD: my_password | |
depends_on: | |
- db | |
db: | |
image: mariadb | |
restart: always | |
environment: | |
MYSQL_ROOT_PASSWORD: my-secret-pw | |
MYSQL_DATABASE: my_database | |
MYSQL_USER: my_username | |
MYSQL_PASSWORD: my_password | |
volumes: | |
- db_data:/var/lib/mysql | |
volumes: | |
db_data: |
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
FROM php:8.0-apache | |
# Install necessary packages | |
RUN apt-get update && \ | |
apt-get install -y mariadb-client && \ | |
apt-get install -y libcurl4-openssl-dev && \ | |
apt-get install -y libz-dev && \ | |
apt-get install -y libpng-dev && \ | |
apt-get install -y libxml2-dev && \ | |
apt-get install -y libonig-dev && \ | |
apt-get install -y libzip-dev && \ | |
apt-get install -y unzip && \ | |
apt-get install -y p7zip-full && \ | |
apt-get install -y git && \ | |
apt-get install -y python python3 && \ | |
docker-php-ext-install mysqli pdo pdo_mysql curl gd xml mbstring zip && \ | |
pecl install xdebug && \ | |
docker-php-ext-enable xdebug && \ | |
apt-get clean && \ | |
rm -rf /var/lib/apt/lists/* | |
# Install Composer | |
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer | |
# Copy source code | |
COPY ./matomo /var/www/html | |
# Set working directory | |
WORKDIR /var/www/html | |
# Run composer TODO -- this needs to run AFTER mount or else the vendor folder gets overridden. | |
# For now we have to manually enter the container and run: | |
# composer install --no-interaction | |
RUN composer install --no-interaction | |
# Set up Apache | |
RUN a2enmod rewrite | |
# Expose port | |
EXPOSE 80 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment