Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
35 changes: 22 additions & 13 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,31 @@
{
"name": "WordPress Plugin Boilerplate",
"name": "WordPress M169 Projekt",
"dockerComposeFile": "docker-compose.yml",
"service": "wordpress",
"workspaceFolder": "/workspace",
"shutdownAction": "stopCompose",

// Use 'settings' to set *default* container specific settings.json values on container create.
// You can edit these settings after create using File > Preferences > Settings > Remote.
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
},
// Add the IDs of extensions you want installed when the container is created in the array below.
"customizations": {
"vscode": {
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
},
"extensions": [
"felixfbecker.php-debug",
"felixfbecker.php-intellisense",
"ikappas.composer",
"ikappas.phpcs"
]
}
},

// felixfbecker.php-debug ermöglicht es, Fehler im Code effektiv zu finden und zu beheben.
// felixfbecker.php-intellisense bietet erweiterte Autovervollständigung und Syntax-Highlighting.
// ikappas.composer erleichtert die Verwaltung von PHP-Paketen.
// ikappas.phpcs stellt sicher, dass der Code den definierten Standards entspricht.

// Use 'appPort' to create a container with published ports. If the port isn't working, be sure
// your server accepts connections from all interfaces (0.0.0.0 or '*'), not just localhost.
Expand All @@ -19,13 +35,6 @@
// "postCreateCommand": "php -v",

// Comment out if you want to use root
"remoteUser": "vscode",
"remoteUser": "vscode"

// Add the IDs of extensions you want installed when the container is created in the array below.
"extensions": [
"felixfbecker.php-debug",
"felixfbecker.php-intellisense",
"ikappas.composer",
"ikappas.phpcs"
]
}
}
5 changes: 5 additions & 0 deletions .env-schema.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# env-schema.txt
WORDPRESS_DB_HOST=<Datenbank Host>
WORDPRESS_DB_USER=<Datenbank Benutzer>
WORDPRESS_DB_PASSWORD=<Datenbank Passwort>
WORDPRESS_DB_NAME=<Datenbank Name>
4 changes: 4 additions & 0 deletions .gitignore/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
WORDPRESS_DB_HOST=db
WORDPRESS_DB_USER=wp_user
WORDPRESS_DB_PASSWORD=wp_pass
WORDPRESS_DB_NAME=wordpress
10 changes: 10 additions & 0 deletions DevContainer_README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# WordPress Dev Container

Dieses Projekt bietet eine Entwicklungsumgebung für WordPress in einem Dev-Container.

## Schritte zum Starten

1. Klonen Sie das Repository:
```bash
git clone https://github.com/noeoedi/wordpress-vscode-container.git
cd wordpress-vscode-container
58 changes: 58 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#-------------------------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
#-------------------------------------------------------------------------------------------------------------

FROM wordpress

# Avoid warnings by switching to noninteractive
ENV DEBIAN_FRONTEND=noninteractive

# Enable WP_DEBUG in wp-config.php
ENV WORDPRESS_DEBUG=1

# This Dockerfile adds a non-root user with sudo access. Use the "remoteUser"
# property in devcontainer.json to use it. On Linux, the container user's GID/UIDs
# will be updated to match your local UID/GID (when using the dockerFile property).
# See https://aka.ms/vscode-remote/containers/non-root-user for details.
ARG USERNAME=vscode
ARG USER_UID=1000
ARG USER_GID=$USER_UID

# Configure apt and install packages
RUN apt-get update \
&& apt-get -y install --no-install-recommends apt-utils dialog 2>&1 \
#
# install git iproute2, procps, lsb-release (useful for CLI installs)
&& apt-get -y install git iproute2 procps iproute2 lsb-release \
#
# Install xdebug
&& yes | pecl install xdebug \
&& echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.ini \
&& echo "xdebug.remote_enable=on" >> /usr/local/etc/php/conf.d/xdebug.ini \
&& echo "xdebug.remote_autostart=on" >> /usr/local/etc/php/conf.d/xdebug.ini \
#
# Create a non-root user to use if preferred - see https://aka.ms/vscode-remote/containers/non-root-user.
&& groupadd --gid $USER_GID $USERNAME \
&& useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME \
# [Optional] Add sudo support for the non-root user
&& apt-get install -y sudo \
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME\
&& chmod 0440 /etc/sudoers.d/$USERNAME \
#
# # Clean up
&& apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*

# Switch back to dialog for any ad-hoc use of apt-get
ENV DEBIAN_FRONTEND=dialog

# Install Composer
RUN curl -sS https://getcomposer.org/installer | php && mv composer.phar /usr/local/bin/composer

# Add WP-CLI
RUN curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar \
&& php wp-cli.phar --info \
&& chmod +x wp-cli.phar \
&& mv wp-cli.phar /usr/local/bin/wp
10 changes: 10 additions & 0 deletions Dockerfile.prod
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Dockerfile.prod
FROM wordpress:latest

COPY . /var/www/html

# Install additional dependencies if needed
RUN apt-get update && apt-get install -y less

# Clean up
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ These instructions should get you a working container environment to test and de

Once the container is built and up and running, you should be able to access the WordPress instance via `http://localhost:8080`. The installer should appear on first run.

## Opening in Dev Container

[![Open in Dev Container](https://img.shields.io/badge/Open%20in-Dev%20Container-blue)](vscode://vscode-remote/containers?url=https://github.com/noeoedi/wordpress-vscode-container)

## Making Changes

If you want to amend the supplied Dockerfile or docker-compose.yml to your own liking, do so but don't forget to use the **Remote-Containers: Rebuild Container** command in VS Code command to rebuild the VS Code container.
Expand Down Expand Up @@ -67,3 +71,4 @@ Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduc
## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

21 changes: 21 additions & 0 deletions docker-compose.prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
version: '3'
services:
wordpress:
build:
context: .
dockerfile: Dockerfile.prod
ports:
- "80:80"
environment:
WORDPRESS_DB_HOST: db
WORDPRESS_DB_USER: wp_user
WORDPRESS_DB_PASSWORD: wp_pass
WORDPRESS_DB_NAME: wordpress
db:
image: mariadb
restart: always
environment:
MYSQL_ROOT_PASSWORD: example
MYSQL_DATABASE: wordpress
MYSQL_USER: wp_user
MYSQL_PASSWORD: wp_pass
34 changes: 34 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
version: '3.6'

services:
db:
image: mariadb
restart: always
networks:
- devnet
environment:
MYSQL_DATABASE: wordydb
MYSQL_USER: wordyuser
MYSQL_PASSWORD: wordypass
MYSQL_RANDOM_ROOT_PASSWORD: '1'

wordpress:
build:
context: .
dockerfile: Dockerfile
restart: always
networks:
- devnet
ports:
- 8080:80
volumes:
- ..:/workspace:cached
- ../wordpress:/var/www/html
environment:
WORDPRESS_DB_HOST: db
WORDPRESS_DB_USER: wordyuser
WORDPRESS_DB_PASSWORD: wordypass
WORDPRESS_DB_NAME: wordydb

networks:
devnet:
3 changes: 3 additions & 0 deletions init-db.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# init-db.sh
#!/bin/bash
wp db import /path/to/dump.sql
3 changes: 3 additions & 0 deletions init/init-db.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# init-db.sh
#!/bin/bash
wp db import /path/to/dump.sql
6 changes: 6 additions & 0 deletions wordpress/.htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# BEGIN WordPress
# The directives (lines) between "BEGIN WordPress" and "END WordPress" are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.

# END WordPress
17 changes: 17 additions & 0 deletions wordpress/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php
/**
* Front to the WordPress application. This file doesn't do anything, but loads
* wp-blog-header.php which does and tells WordPress to load the theme.
*
* @package WordPress
*/

/**
* Tells WordPress to load the WordPress theme and output it.
*
* @var bool
*/
define( 'WP_USE_THEMES', true );

/** Loads the WordPress Environment and Template */
require __DIR__ . '/wp-blog-header.php';
Loading