Replace Vagrant with Docker
This commit is contained in:
parent
9b3fdf386b
commit
895c7b0b29
@ -12,5 +12,8 @@ indent_size = 2
|
|||||||
[gulpfile.js]
|
[gulpfile.js]
|
||||||
indent_size = 2
|
indent_size = 2
|
||||||
|
|
||||||
|
[package.json]
|
||||||
|
indent_size = 2
|
||||||
|
|
||||||
[Makefile]
|
[Makefile]
|
||||||
indent_style = tab
|
indent_style = tab
|
||||||
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,3 +1,6 @@
|
|||||||
|
.composer
|
||||||
|
.npm
|
||||||
|
.vagrant
|
||||||
/ansible/galaxy.roles/
|
/ansible/galaxy.roles/
|
||||||
/output_*
|
/output_*
|
||||||
/node_modules/
|
/node_modules/
|
||||||
|
25
Dockerfile
Normal file
25
Dockerfile
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
FROM php:7.2-cli
|
||||||
|
|
||||||
|
# Project folder
|
||||||
|
RUN mkdir -p /var/homepage
|
||||||
|
|
||||||
|
WORKDIR /srv/homepage
|
||||||
|
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get install -y git gnupg \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# get composer and required tools
|
||||||
|
RUN curl -sLO https://getcomposer.org/download/1.5.2/composer.phar \
|
||||||
|
&& mv composer.phar /usr/local/bin/composer \
|
||||||
|
&& chmod +x /usr/local/bin/composer
|
||||||
|
|
||||||
|
# Deployer
|
||||||
|
RUN curl -sLO https://deployer.org/releases/v6.0.3/deployer.phar \
|
||||||
|
&& mv deployer.phar /usr/local/bin/dep \
|
||||||
|
&& chmod +x /usr/local/bin/dep
|
||||||
|
|
||||||
|
# install npm
|
||||||
|
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - \
|
||||||
|
&& apt-get install -y nodejs \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
18
Makefile
18
Makefile
@ -1,13 +1,17 @@
|
|||||||
build:
|
clean-files:
|
||||||
rm -rf output_dev/*
|
rm -rf output_dev/*
|
||||||
vendor/bin/sculpin generate --env=dev --no-interaction
|
|
||||||
BUILD_ENV=dev node_modules/.bin/gulp build
|
|
||||||
|
|
||||||
deploy:
|
build: clean-files
|
||||||
rm -rf output_prod/*
|
./tools/sculpin generate --env=dev --no-interaction
|
||||||
vendor/bin/sculpin generate --env=prod --no-interaction
|
./tools/npm build
|
||||||
BUILD_ENV=prod node_modules/.bin/gulp build
|
|
||||||
|
deploy: clean-files
|
||||||
|
./tools/sculpin generate --env=prod --no-interaction
|
||||||
|
./tools/npm build-prod
|
||||||
deployer deploy production
|
deployer deploy production
|
||||||
|
|
||||||
rollback:
|
rollback:
|
||||||
deployer rollback production
|
deployer rollback production
|
||||||
|
|
||||||
|
docker-build:
|
||||||
|
docker build --tag homepage-php .
|
||||||
|
23
Vagrantfile
vendored
23
Vagrantfile
vendored
@ -1,23 +0,0 @@
|
|||||||
# -*- mode: ruby -*-
|
|
||||||
# vi: set ft=ruby :
|
|
||||||
|
|
||||||
ENV["LC_ALL"] = "en_US.UTF-8"
|
|
||||||
|
|
||||||
# For installing ansible_local from pip on guest
|
|
||||||
Vagrant.require_version ">= 1.8.3"
|
|
||||||
|
|
||||||
Vagrant.configure("2") do |config|
|
|
||||||
|
|
||||||
config.vm.box = "ubuntu/trusty64"
|
|
||||||
|
|
||||||
config.vm.network "forwarded_port", guest: 80, host: 8080
|
|
||||||
|
|
||||||
config.vm.provision "ansible_local" do |ansible|
|
|
||||||
ansible.playbook = "ansible/vagrant-provision.yml"
|
|
||||||
ansible.galaxy_role_file = "ansible/vagrant-requirements.yml"
|
|
||||||
ansible.galaxy_roles_path = "ansible/galaxy.roles"
|
|
||||||
ansible.sudo = true
|
|
||||||
end
|
|
||||||
|
|
||||||
config.ssh.forward_agent = true
|
|
||||||
end
|
|
@ -1,6 +0,0 @@
|
|||||||
---
|
|
||||||
- name: Create nginx config
|
|
||||||
template:
|
|
||||||
src: site.conf.j2
|
|
||||||
dest: /etc/nginx/sites-enabled/{{ nginx_conf_name }}
|
|
||||||
notify: restart nginx
|
|
@ -1,14 +0,0 @@
|
|||||||
server {
|
|
||||||
listen 80;
|
|
||||||
server_name {{ nginx_conf_domain }} www.{{ nginx_conf_domain }};
|
|
||||||
|
|
||||||
location / {
|
|
||||||
root {{ nginx_conf_root }};
|
|
||||||
index index.html;
|
|
||||||
try_files $uri $uri/ =404;
|
|
||||||
}
|
|
||||||
|
|
||||||
{% if not nginx_conf_sendfile|default(true) %}
|
|
||||||
sendfile off;
|
|
||||||
{% endif %}
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
---
|
|
||||||
- name: Update apt cache
|
|
||||||
apt: update_cache=yes
|
|
||||||
|
|
||||||
- name: Install system packages
|
|
||||||
apt: pkg={{ item }} state=latest
|
|
||||||
with_items:
|
|
||||||
- curl
|
|
||||||
- wget
|
|
||||||
- python-software-properties
|
|
||||||
- git
|
|
@ -1,34 +0,0 @@
|
|||||||
---
|
|
||||||
- hosts: all
|
|
||||||
|
|
||||||
vars:
|
|
||||||
application_root: /vagrant
|
|
||||||
|
|
||||||
timezone: UTC
|
|
||||||
|
|
||||||
nginx_conf_name: anwinged.conf
|
|
||||||
nginx_conf_root: '{{ application_root }}/output_dev'
|
|
||||||
nginx_conf_domain: anwinged.ru
|
|
||||||
nginx_conf_sendfile: false
|
|
||||||
|
|
||||||
nginx_remove_default_vhost: true
|
|
||||||
|
|
||||||
php_enable_webserver: false
|
|
||||||
php_packages:
|
|
||||||
- php7.1
|
|
||||||
- php7.1-mbstring
|
|
||||||
- php7.1-intl
|
|
||||||
- php7.1-curl
|
|
||||||
- php7.1-xml
|
|
||||||
|
|
||||||
|
|
||||||
pre_tasks:
|
|
||||||
- name: Ensure that PHP Ondrej PPA is added
|
|
||||||
apt_repository: repo=ppa:ondrej/php state=present
|
|
||||||
|
|
||||||
roles:
|
|
||||||
- yatesr.timezone
|
|
||||||
- server
|
|
||||||
- geerlingguy.nginx
|
|
||||||
- nginx
|
|
||||||
- geerlingguy.php
|
|
@ -1,12 +0,0 @@
|
|||||||
---
|
|
||||||
- src: yatesr.timezone
|
|
||||||
version: 1.0.0
|
|
||||||
|
|
||||||
- src: geerlingguy.nginx
|
|
||||||
version: 1.9.6
|
|
||||||
|
|
||||||
- src: geerlingguy.php
|
|
||||||
version: 3.4.2
|
|
||||||
|
|
||||||
- src: geerlingguy.composer
|
|
||||||
version: 1.5.0
|
|
@ -34,6 +34,6 @@ gulp.task('build', function () {
|
|||||||
;
|
;
|
||||||
});
|
});
|
||||||
|
|
||||||
// gulp.task('build:watch', function () {
|
gulp.task('build:watch', function () {
|
||||||
// gulp.watch(SASS_SOURCE_PATH, ['build']);
|
gulp.watch(SASS_SOURCE_PATH, ['build']);
|
||||||
// });
|
});
|
||||||
|
3262
package-lock.json
generated
Normal file
3262
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -9,5 +9,10 @@
|
|||||||
"gulp-autoprefixer": "^3.1.1",
|
"gulp-autoprefixer": "^3.1.1",
|
||||||
"gulp-concat": "^2.6.1",
|
"gulp-concat": "^2.6.1",
|
||||||
"gulp-sass": "^3.1.0"
|
"gulp-sass": "^3.1.0"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"build": "BUILD_ENV=dev gulp build",
|
||||||
|
"watch": "BUILD_ENV=dev gulp build:watch",
|
||||||
|
"build-prod": "BUILD_ENV=prod gulp build"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
|
|
||||||
|
|
||||||
&__note {
|
&__note {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: 120%;
|
font-size: 120%;
|
||||||
|
17
tools/composer
Executable file
17
tools/composer
Executable file
@ -0,0 +1,17 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
source .env
|
||||||
|
|
||||||
|
mkdir -p ./.composer/cache
|
||||||
|
|
||||||
|
docker run \
|
||||||
|
--rm \
|
||||||
|
--interactive \
|
||||||
|
--tty \
|
||||||
|
--user $UID:$(id -g) \
|
||||||
|
--volume /etc/passwd:/etc/passwd:ro \
|
||||||
|
--volume /etc/group:/etc/group:ro \
|
||||||
|
--volume $PWD:/srv/homepage \
|
||||||
|
--volume $PWD/.composer:/tmp/.composer \
|
||||||
|
--env COMPOSER_HOME=/tmp/.composer \
|
||||||
|
${HOMEPAGE_IMAGE} composer "$@"
|
15
tools/dep
Executable file
15
tools/dep
Executable file
@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
source .env
|
||||||
|
|
||||||
|
docker run \
|
||||||
|
--rm \
|
||||||
|
--user "$UID" \
|
||||||
|
--volume /etc/passwd:/etc/passwd:ro \
|
||||||
|
--volume /etc/group:/etc/group:ro \
|
||||||
|
--volume $SSH_AUTH_SOCK:/ssh-agent --env SSH_AUTH_SOCK=/ssh-agent \
|
||||||
|
--volume "$PWD:/srv/homepage" \
|
||||||
|
--interactive \
|
||||||
|
--tty \
|
||||||
|
${HOMEPAGE_IMAGE} \
|
||||||
|
dep "$@"
|
15
tools/npm
Executable file
15
tools/npm
Executable file
@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
source .env
|
||||||
|
|
||||||
|
mkdir -p ./.npm
|
||||||
|
|
||||||
|
docker run \
|
||||||
|
--rm \
|
||||||
|
--interactive \
|
||||||
|
--tty \
|
||||||
|
--user $UID:$(id -g) \
|
||||||
|
--volume $PWD:/srv/homepage \
|
||||||
|
--volume $PWD/.npm:/tpm/.npm \
|
||||||
|
--env npm_config_cache=/tmp/.npm \
|
||||||
|
${HOMEPAGE_IMAGE} npm "$@"
|
15
tools/sculpin
Executable file
15
tools/sculpin
Executable file
@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
source .env
|
||||||
|
|
||||||
|
docker run \
|
||||||
|
--rm \
|
||||||
|
--user "$UID" \
|
||||||
|
--init \
|
||||||
|
--volume="$PWD:/srv/homepage" \
|
||||||
|
--expose=8000 \
|
||||||
|
--publish=8000:8000 \
|
||||||
|
--interactive \
|
||||||
|
--tty \
|
||||||
|
${HOMEPAGE_IMAGE} \
|
||||||
|
./vendor/bin/sculpin "$@"
|
Loading…
Reference in New Issue
Block a user