-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
David Cole
committed
Apr 2, 2019
1 parent
a799afa
commit cb4b165
Showing
60 changed files
with
1,083 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
{% set blocks = '_twig/docker-compose.yml/' %} | ||
{% set dockersync = false %} | ||
{% if @('host.os') == 'darwin' and @('docker-sync') == 'yes' %} | ||
{% set dockersync = true %} | ||
{% endif %} | ||
|
||
console: | ||
{% if @('app.build') == 'dynamic' %} | ||
build: | ||
context: ../ | ||
dockerfile: .my127ws/docker/image/console/Dockerfile | ||
entrypoint: /entrypoint.dynamic.sh | ||
volumes: | ||
- {{ (dockersync) ? @('workspace.name') ~ '-sync:/app:nocopy' : '../:/app:delegated' }} | ||
- ./application:/home/build/application | ||
- ./docker/image/console/root/lib/task:/lib/task | ||
{% else %} | ||
image: {{ @('docker.repository') ~ ':' ~ @('app.version') ~ '-console' }} | ||
{% endif %} | ||
labels: | ||
- traefik.enable=false | ||
environment: &APP_ENV_VARS | ||
{% include blocks ~ 'environment.yml.twig' %} | ||
networks: | ||
- private | ||
|
||
nginx: | ||
{% if @('app.build') == 'dynamic' %} | ||
build: docker/image/nginx | ||
volumes: | ||
- {{ (dockersync) ? @('workspace.name') ~ '-sync:/app:nocopy' : '../:/app:delegated' }} | ||
{% else %} | ||
image: {{ @('docker.repository') ~ ':' ~ @('app.version') ~ '-nginx' }} | ||
{% endif %} | ||
labels: | ||
- traefik.backend=${APP_NAME} | ||
- traefik.frontend.rule=Host:${APP_HOST} | ||
- traefik.docker.network=my127ws | ||
- traefik.port=80 | ||
links: | ||
- php-fpm:php-fpm | ||
networks: | ||
private: | ||
aliases: | ||
- {{ @('hostname') }} | ||
shared: {} | ||
|
||
php-fpm: | ||
{% if @('app.build') == 'dynamic' %} | ||
build: docker/image/php-fpm | ||
entrypoint: /entrypoint.dynamic.sh | ||
volumes: | ||
- {{ (dockersync) ? @('workspace.name') ~ '-sync:/app:nocopy' : '../:/app:delegated' }} | ||
{% else %} | ||
image: {{ @('docker.repository') ~ ':' ~ @('app.version') ~ '-php-fpm' }} | ||
{% endif %} | ||
labels: | ||
- traefik.enable=false | ||
networks: | ||
- private | ||
environment: | ||
<<: *APP_ENV_VARS |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
chrome: | ||
image: yukinying/chrome-headless-browser:latest | ||
command: ["--no-sandbox", "--disable-gpu", "--headless", "--disable-dev-shm-usage", "--remote-debugging-address=0.0.0.0", "--remote-debugging-port=9222", "--user-data-dir=/data"] | ||
labels: | ||
- traefik.enable=false | ||
networks: | ||
- private |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
memcached: | ||
image: memcached:1-alpine | ||
labels: | ||
- traefik.enable=false | ||
networks: | ||
- private |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
mysql: | ||
image: mysql:5.7 | ||
labels: | ||
- traefik.enable=false | ||
environment: | ||
- MYSQL_ROOT_PASSWORD=${DB_ROOT_PASS} | ||
- MYSQL_DATABASE=${DB_NAME} | ||
- MYSQL_USER=${DB_USER} | ||
- MYSQL_PASSWORD=${DB_PASS} | ||
networks: | ||
- private | ||
ports: | ||
- 3306 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
redis-session: | ||
image: redis:4-alpine | ||
# 1GB; evict key that would expire soonest | ||
command: redis-server --maxmemory 1073742000 --maxmemory-policy volatile-ttl | ||
labels: | ||
- traefik.enable=false | ||
networks: | ||
- private |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
redis: | ||
image: redis:4-alpine | ||
# 1GB; evict any least recently used key even if they don't have a TTL | ||
command: redis-server --maxmemory 1073742000 --maxmemory-policy allkeys-lru | ||
labels: | ||
- traefik.enable=false | ||
networks: | ||
- private |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{% set build = @('app.build') %} | ||
{% set blocks = 'application/overlay/_twig/.dockerignore/' %} | ||
|
||
{% if build == 'dynamic' %} | ||
{% include blocks ~ 'dynamic.twig' %} | ||
{% else %} | ||
{% include blocks ~ 'static.twig' %} | ||
{% endif %} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
pipeline { | ||
agent { label "my127ws" } | ||
environment { | ||
MY127WS_KEY = credentials('{{ @('workspace.name') }}-my127ws-key') | ||
MY127WS_ENV = "pipeline" | ||
} | ||
stages { | ||
stage('Build') { | ||
steps { sh 'ws install' } | ||
} | ||
stage('Test') { | ||
parallel { | ||
stage('quality') { steps { sh 'ws exec composer test-quality' } } | ||
stage('unit') { steps { sh 'ws exec composer test-unit' } } | ||
stage('acceptance') { steps { sh 'ws exec composer test-acceptance' } } | ||
} | ||
} | ||
} | ||
post { | ||
always { | ||
sh 'ws destroy' | ||
cleanWs() | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
* | ||
!.my127ws |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# no need for exclusions for now |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"http-basic": { | ||
{% for repo in @('composer.auth.basic') %} | ||
"{{ repo.path }}": { | ||
"username": "{{ repo.username }}", | ||
"password": "{{ repo.password }}" | ||
}{% if not loop.last %},{% endif %} | ||
{% endfor %} | ||
}, | ||
"github-oauth": { | ||
{% if @('composer.auth.github') %} | ||
"github.com": "{{ @('composer.auth.github') }}" | ||
{% endif %} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{% set blocks = '_twig/docker-compose.yml/' %} | ||
{% set dockersync = false %} | ||
{% if @('host.os') == 'darwin' and @('docker-sync') == 'yes' %} | ||
{% set dockersync = true %} | ||
{% endif %} | ||
version: '3' | ||
services: | ||
{% include blocks ~ 'application.yml.twig' %} | ||
{% for service in @('app.services') %} | ||
{% include blocks ~ 'service/' ~ service ~ '.yml.twig' %} | ||
{% endfor %} | ||
networks: | ||
private: | ||
external: false | ||
shared: | ||
external: | ||
name: my127ws | ||
{% if dockersync %} | ||
volumes: | ||
{{ @('workspace.name') }}-sync: | ||
external: true | ||
{% endif %} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
version: '2' | ||
options: | ||
compose-file-path: | ||
- .my127ws/docker-compose.yml | ||
syncs: | ||
{{ @('workspace.name') }}-sync: | ||
src: ../ | ||
sync_userid: '1000' | ||
sync_excludes_type: BelowPath | ||
sync_excludes: &IGNORE | ||
- .docker-sync | ||
- .idea | ||
- .my127ws | ||
- .git | ||
- var | ||
watch_excludes: *IGNORE |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
**/*.twig |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
FROM {{ @('docker.image.console') }} | ||
|
||
COPY .my127ws/docker/image/console/root / | ||
RUN chown -R build:build /home/build | ||
|
||
ENV APP_MODE={{ @('app.mode') }} \ | ||
ASSETS_DIR={{ @('assets.local') }} | ||
|
||
{% if @('node.version') is not null %} | ||
USER build | ||
RUN . /home/build/.nvm/nvm.sh \ | ||
&& nvm install {{ @('node.version') }} \ | ||
&& nvm use {{ @('node.version') }} \ | ||
&& nvm alias default {{ @('node.version') }} \ | ||
&& npm install -g yarn | ||
USER root | ||
{% endif %} | ||
|
||
{% if @('app.build') == 'static' %} | ||
RUN chown build:build /app | ||
COPY --chown=build:build .my127ws/application /home/build/application | ||
COPY --chown=build:build ./ /app | ||
USER build | ||
RUN app build | ||
USER root | ||
{% else %} | ||
VOLUME /app | ||
VOLUME /home/build/application | ||
{% endif %} | ||
|
||
ENTRYPOINT /entrypoint.sh |
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
main() | ||
{ | ||
task "$@" | ||
} | ||
|
||
bootstrap() | ||
{ | ||
export NVM_DIR="$HOME/.nvm" | ||
# shellcheck source=/home/build/nvm.sh | ||
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" | ||
. /lib/sidekick.sh | ||
} | ||
|
||
bootstrap | ||
main "$@" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/bin/bash | ||
|
||
main() | ||
{ | ||
source /entrypoint.sh | ||
} | ||
|
||
setup_app_volume_permissions() | ||
{ | ||
case "$STRATEGY" in | ||
"host-linux-normal") | ||
usermod -u "$(stat -c '%u' /app)" build | ||
groupmod -g "$(stat -c '%g' /app)" build | ||
;; | ||
"host-osx-normal") | ||
usermod -u 1000 build | ||
groupmod -g 1000 build | ||
;; | ||
"host-osx-dockersync") | ||
usermod -u 1000 build | ||
groupmod -g 1000 build | ||
;; | ||
*) | ||
exit 1 | ||
esac | ||
|
||
chown build:build /app | ||
} | ||
|
||
resolve_volume_mount_strategy() | ||
{ | ||
if [ "${HOST_OS_FAMILY}" = "linux" ]; then | ||
STRATEGY="host-linux-normal" | ||
elif [ "${HOST_OS_FAMILY}" = "darwin" ]; then | ||
if (mount | grep "/app type fuse.osxfs") &2>1 > /dev/null; then | ||
STRATEGY="host-osx-normal" | ||
elif (mount | grep "/app type ext4") &2>1 > /dev/null; then | ||
STRATEGY="host-osx-dockersync" | ||
else | ||
exit 1 | ||
fi | ||
else | ||
exit 1 | ||
fi | ||
} | ||
|
||
bootstrap() | ||
{ | ||
resolve_volume_mount_strategy | ||
setup_app_volume_permissions | ||
} | ||
|
||
bootstrap | ||
main |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/bin/bash | ||
|
||
main() | ||
{ | ||
su - build | ||
sh -c 'while sleep 3600; do :; done' | ||
} | ||
|
||
setup_app_networking() | ||
{ | ||
# make linux consistent with docker-for-mac | ||
if [ "${HOST_OS_FAMILY}" = "linux" ]; then | ||
DOCKER_INTERNAL_HOST="host.docker.internal" | ||
if ! grep $DOCKER_INTERNAL_HOST /etc/hosts > /dev/null ; then | ||
DOCKER_INTERNAL_IP=$(/sbin/ip route|awk '/default/ { print $3 }') | ||
echo -e "$DOCKER_INTERNAL_IP $DOCKER_INTERNAL_HOST" | tee -a /etc/hosts > /dev/null | ||
fi | ||
fi | ||
} | ||
|
||
bootstrap() | ||
{ | ||
setup_app_networking | ||
} | ||
|
||
bootstrap | ||
main |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[client] | ||
host=mysql | ||
user=root |
Oops, something went wrong.