Skip to content

Instantly share code, notes, and snippets.

View AlexanderAllen's full-sized avatar
😸
Working from home @ Bushwick, NYC

AlexanderAllen AlexanderAllen

😸
Working from home @ Bushwick, NYC
View GitHub Profile
@AlexanderAllen
AlexanderAllen / localenv-drush.sh
Created January 1, 2020 22:42
Wake Up The Kraken : Fire up Drush Container
#!/bin/bash
# Using user-defined network eliminates need to use service links,
# and allows multiple compose stacks to join/leave network on a as-needed basis -
# as opposed to composing up or down an entire monolith compose stack.
#
# For benefits of user-defined bridge over default bridge https://docs.docker.com/network/bridge/
# Compose networking: https://docs.docker.com/compose/networking/
# Latest compose reference: https://docs.docker.com/compose/compose-file/#network-configuration-reference
@AlexanderAllen
AlexanderAllen / install_docker_ubuntu_wsl.sh
Created January 2, 2020 23:57
Setting Ubuntu for WSL on Windows 10
# Update the apt package list.
sudo apt-get update -y
# Install Docker's package dependencies.
sudo apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
software-properties-common
@AlexanderAllen
AlexanderAllen / wsl.conf
Created January 3, 2020 00:02
/etc/wsl.conf
# Save this into /etc/wsl.conf
# You will need sudo permissions setup in WSL.
# sudo vi /etc/wsl.conf
[automount]
enabled=true
# Mount root to /drive/ instead of /mnt/drive for docker compatibility.
root=/
# Unsets (unmasks) -wx bits for group/other so perms don't show up as 777 on WSL.
options="metadata,umask=22,fmask=11"
@AlexanderAllen
AlexanderAllen / .bashrc
Created January 3, 2020 00:06
Apply proper umask on WSL
# Note: Bash on Windows does not currently apply umask properly, fix it here.
if [[ "$(umask)" = "0000" ]]; then
umask 0022
fi
@AlexanderAllen
AlexanderAllen / bloatware_corporation.Dockerfile
Last active January 3, 2020 07:31
Or, how not to build Dockerfiles
FROM alexanderallen/php7-fpm.core:alpine-3.11 as core
ENV \
SSH_PRIVATE_KEY="/root/.ssh/id_rsa" \
LANG="en_US.UTF-8" \
LC_ALL="en_US.UTF-8" \
LANGUAGE="en_US.UTF-8" \
TERM="xterm" \
# Register the COMPOSER_HOME environment variable.
COMPOSER_HOME=/composer \
@AlexanderAllen
AlexanderAllen / marie-kondo'd.Dockerfile
Created January 3, 2020 07:35
Optimized Dockerfile for Composer and Drush, moved optional tooling into new, optional build targets.
FROM alexanderallen/php7-fpm.core:alpine-3.11 as core
ENV \
SSH_PRIVATE_KEY="/root/.ssh/id_rsa" \
LANG="en_US.UTF-8" \
LC_ALL="en_US.UTF-8" \
LANGUAGE="en_US.UTF-8" \
TERM="xterm" \
# Register the COMPOSER_HOME environment variable.
COMPOSER_HOME=/composer \
@AlexanderAllen
AlexanderAllen / composer.json
Created January 3, 2020 07:51
Drush 9 Composer Manifest
{
"name": "alexanderallen/php-cli.drush9",
"description": "Composer dependencies for Drupal 8.4+ development.",
"require": {
"drush/drush": "~9.0",
"symfony/yaml": "~3.0",
"pear/pear-core-minimal": "1.10.1"
}
}
@AlexanderAllen
AlexanderAllen / default.conf
Created January 4, 2020 18:20
Final nginx default conf
server {
listen 8080;
server_name localhost;
root /app/web; ## <-- Your only path reference.
location = /favicon.ico {
log_not_found off;
access_log off;
}
@AlexanderAllen
AlexanderAllen / docker-compose.yml
Created January 14, 2020 01:36
Forward logs to Nginx as non-root user, by using the tty parameter
nginx:
image: alexanderallen/nginx:1.17-alpine
tty: true
entrypoint: 'su-exec nobody /usr/sbin/nginx -g "daemon off;"'
ports:
- 80:8080
- 443:443
healthcheck:
test: curl --fail -s http://localhost:80 || exit 1
interval: 30s
@AlexanderAllen
AlexanderAllen / Makefile
Created January 31, 2020 15:41
Docker workload excerpt
# The php files are mounted from the host so access is slow.
slow: pull www
docker run --rm --name symfony-demo -p 8080:8080 -v $(shell pwd)/www:/var/www djs55/symfony-demo