Compare commits

..

No commits in common. "50a719ef1241e51a98b5c023d6dca298ff3fe343" and "2d5079cf73fc88d798380bc61df40f3e4c0c0a93" have entirely different histories.

3 changed files with 52 additions and 51 deletions

View File

@ -1,16 +1,11 @@
FROM mcr.microsoft.com/devcontainers/php:1-${templateOption:imageVariant} FROM php:8-apache
# Install MariaDB client RUN apt-get update && apt-get upgrade && apt-get install -y imagemagick
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get install -y mariadb-client \
&& apt-get clean -y && rm -rf /var/lib/apt/lists/*
# Install php-mysql driver RUN a2enmod ssl && a2enmod rewrite
RUN docker-php-ext-install mysqli pdo pdo_mysql
# [Optional] Uncomment this section to install additional OS packages. # Built-in tool for adding modules
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ RUN docker-php-ext-install pdo pdo_mysql
# && apt-get -y install --no-install-recommends <your-package-list-here>
# [Optional] Uncomment this line to install global node packages. RUN chmod u+s,g+s /var/www/html/
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1 RUN chown -R www-data:www-data /var/www/html/

View File

@ -1,23 +1,40 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the // For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/php-mariadb // README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-docker-compose
{ {
"name": "PHP & MariaDB", "name": "Existing Docker Compose (Extend)",
"dockerComposeFile": "docker-compose.yml",
"service": "app", // Update the 'dockerComposeFile' list if you have more compose files or use different names.
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", // The .devcontainer/docker-compose.yml file contains any overrides you need/want to make.
"dockerComposeFile": [
"../.devcontainer/docker-compose.yml"
],
// The 'service' property is the name of the service for the container that VS Code should
// use. Update this value and .devcontainer/docker-compose.yml to the real service name.
"service": "web",
// The optional 'workspaceFolder' property is the path VS Code should open by default when
// connected. This is typically a file mount in .devcontainer/docker-compose.yml
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}"
// Features to add to the dev container. More info: https://containers.dev/features. // Features to add to the dev container. More info: https://containers.dev/features.
// "features": {}, // "features": {},
// For use with PHP or Apache (e.g.php -S localhost:8080 or apache2ctl start) // Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [8080, 3306] // "forwardPorts": [],
// Use 'postCreateCommand' to run commands after the container is created. // Uncomment the next line if you want start specific services in your Docker Compose config.
// "postCreateCommand": "sudo chmod a+x \"$(pwd)\" && sudo rm -rf /var/www/html && sudo ln -s \"$(pwd)\" /var/www/html" // "runServices": [],
// Uncomment the next line if you want to keep your containers running after VS Code shuts down.
// "shutdownAction": "none",
// Uncomment the next line to run commands after the container is created.
// "postCreateCommand": "cat /etc/os-release",
// Configure tool-specific properties. // Configure tool-specific properties.
// "customizations": {}, // "customizations": {},
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. // Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root" // "remoteUser": "devcontainer"
} }

View File

@ -1,36 +1,25 @@
version: '3.8' services:
web:
services:
app:
build: build:
context: . context: .
dockerfile: Dockerfile dockerfile: Dockerfile
volumes: volumes:
- ../..:/workspaces:cached - ../..:/workspaces:cached
ports:
# Overrides default command so things don't shut down after the process ends. - 8085:80
command: sleep infinity depends_on:
- db
# Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function.
network_mode: service:db
# Use "forwardPorts" in **devcontainer.json** to forward an app port locally.
# (Adding the "ports" property to this file will not forward from a Codespace.)
db: db:
image: mariadb:10.4 image: mariadb:latest
restart: unless-stopped command: --sql-mode=""
volumes:
- mariadb-data:/var/lib/mysql
environment: environment:
MYSQL_ROOT_PASSWORD: mariadb MYSQL_ROOT_PASSWORD: secret
MYSQL_DATABASE: mariadb MYSQL_DATABASE: sfiab
MYSQL_USER: mariadb MYSQL_USER: sfiab
MYSQL_PASSWORD: mariadb MYSQL_PASSWORD: ScienceFair123!
ports:
# Add "forwardPorts": ["3306"] to **devcontainer.json** to forward MariaDB locally. - 3306:3306
# (Adding the "ports" property to this file will not forward from a Codespace.) volumes:
- db_data:/var/lib/mysql
volumes: volumes:
mariadb-data: db_data: