Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding the possibility to use Dev Container for building #60

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-in-docker
{
"name": "jQuery Validation Documentation",
"image": "mcr.microsoft.com/devcontainers/base:bullseye",

"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {
"version": "20.10",
"enableNonRootDocker": "true",
"moby": "true"
},
"ghcr.io/devcontainers/features/git:1": {},
"ghcr.io/devcontainers-contrib/features/wget-apt-get:1": {},
"ghcr.io/devcontainers/features/node:1": {}
},
"forwardPorts": [8080],
"postCreateCommand": ".devcontainer/postCreateCommand.sh"
}
18 changes: 18 additions & 0 deletions .devcontainer/postCreateCommand.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

#prepare wordpress installation
cp config-sample-docker.json config.json
mkdir -p wordpress/wp-content
wget https://downloads.wordpress.org/theme/twentytwelve.4.3.zip -O /tmp/twentytwelve.4.3.zip && unzip /tmp/twentytwelve.4.3.zip -d wordpress/wp-content/themes && rm -f /tmp/twentytwelve.4.3.zip
sudo git clone https://github.com/jzaefferer/validation-theme wordpress/wp-content/themes/validation-theme
mkdir -p wordpress/wp-content/plugins/gilded-wordpress && wget https://raw.githubusercontent.com/scottgonzalez/gilded-wordpress/v1.0.0/gilded-wordpress.php -O wordpress/wp-content/plugins/gilded-wordpress/gilded-wordpress.php
mkdir -p wordpress/wp-content/plugins/jquery-static-index && wget https://raw.githubusercontent.com/jquery/jquery-wp-content/v4.0.1/plugins/jquery-static-index.php -O wordpress/wp-content/plugins/jquery-static-index/jquery-static-index.php

# setup additional dependencies here (would features be a better place?)
sudo apt-get update && sudo apt-get install libxml2-utils libxslt1.1 xsltproc -y

# setup grunt globally
npm install -g grunt-cli

# install local dependencies
npm install
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for more information:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
# https://containers.dev/guide/dependabot

version: 2
updates:
- package-ecosystem: "devcontainers"
directory: "/"
schedule:
interval: weekly
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
dist
node_modules
config.json
wordpress
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -33,3 +33,27 @@ In this repo:
### Deploy

`grunt deploy`

## Building with Dev Containers
The Dev Container is a DIND (docker-in-docker) which comes with all the requirements pre-installed. Start the WordPress instance with:

`docker-compose up` and visit `http://localhost:8080`

### Requirements
* Open this repository in Visual Studio Code with Dev Containers extension installed (https://code.visualstudio.com/docs/devcontainers/containers)

### Installation
* Setup WordPress with:
* **Site Title**: Form validation with jQuery
* **Username**: admin
* **Password**: secret
* *tick the checkbox 'Confirm use of weak password'*
* **Your Email**: <enter a valid email address>
* Activate theme 'jQuery Validation Plugin WordPress Theme' (Appeareance)
* Activate plugin 'Gilded WordPress XML-RPC extensions' (Plugins)
* Activate plugin 'jQuery Static Index' (Plugins)


### Deploy

`grunt deploy`
9 changes: 9 additions & 0 deletions config-sample-docker.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"url": "http://localhost:8080",
"username": "admin",
"password": "secret",
"basicAuth": {
"username": "basic-auth-admin",
"password": "basic-auth-secret"
}
}
28 changes: 28 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
services:
mariadb:
image: mariadb:lts
environment:
MYSQL_ROOT_PASSWORD: rootpassword
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: jqueryvalidation
healthcheck:
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
start_period: 10s
interval: 10s
timeout: 5s
retries: 3
wordpress:
image: wordpress:4.7
ports:
- 8080:80
environment:
WORDPRESS_DB_HOST: mariadb:3306
WORDPRESS_DB_NAME: wordpress
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: jqueryvalidation
volumes:
- ./wordpress/wp-content:/var/www/html/wp-content
depends_on:
mariadb:
condition: service_healthy
787 changes: 545 additions & 242 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -23,5 +23,8 @@
"dependencies": {
"grunt": "0.4.5",
"grunt-jquery-content": "2.0.0"
},
"overrides": {
"graceful-fs": "^4.2.11"
}
}