Commit bfc1c203 authored by Julien Fastré's avatar Julien Fastré

add makefile to build and push image

parent 5fcf9837
......@@ -4,4 +4,5 @@ vendor/*/*/.git/*
app/config/parameters.yml
.composer*
.git*
.yarncache/*
.node_modules/*
......@@ -3,7 +3,18 @@ PWD:=$(shell echo ${PWD})
UID:=$(shell id -u)
GID:=$(shell id -g)
DOCKERNODE_CMD=docker run --rm --user ${UID}:${GID} -v ${PWD}:/app --workdir /app -e YARN_CACHE_FOLDER=/app/.yarncache node:9
DOCKER_COMPOSE_PHP_EXEC_CMD=docker-compose run --user $(UID) --entrypoint /usr/bin/env php
PHP_BASE_IMAGE=php:7.2-fpm
NGINX_BASE_IMAGE=nginx
help:
@echo "Please make use of 'make <target>' where <target> is one of: "
@echo " build-assets to build assets for production"
@echo " build-and-push-images to build image PHP and NGINX and push them on a registry"
@echo " init to initialize your development directory"
@echo " install-vendor to install vendor using composer"
@echo " pull-base-image to pull base image used in image php and nginx"
@echo " upgrade-vendors to upgrade vendor"
build-assets:
$(DOCKERNODE_CMD) yarn install
......@@ -12,3 +23,21 @@ build-assets:
init:
docker run --rm -e INSTALL_ID=$(UID) -e INSTALL_GID=$(GID) -e COMPOSER_HOME=/var/www/app/.composer --volume $(PWD):/var/www/app --workdir /var/www/app php:7.2-cli /bin/bash ./docker/install.dev.sh
@$(MAKE) -f $(THIS_FILE) build-assets
push-images:
docker-compose push php nginx
pull-base-images:
docker pull $(PHP_BASE_IMAGE)
docker pull $(NGINX_BASE_IMAGE)
build-and-push-images:
@$(MAKE) -f $(THIS_FILE) build-assets
docker-compose build php nginx
@$(MAKE) -f $(THIS_FILE) push-images
upgrade-vendors:
$(DOCKER_COMPOSE_PHP_EXEC_CMD) php composer.phar upgrade
install-vendors:
$(DOCKER_COMPOSE_PHP_EXEC_CMD) php composer.phar install
This diff is collapsed.
......@@ -7,7 +7,7 @@ services:
args:
UID: ${PHP_FPM_USER:-1000}
# uncomment and set your own image if needed
# image: chill/activity-docs-person-report-task-php:${VERSION:-latest}
image: ${IMAGE_PHP:-chill/activity-docs-person-report-task-php}:${VERSION:-latest}
volumes:
- .:/var/www/app
environment:
......@@ -49,7 +49,7 @@ services:
build:
context: .
dockerfile: docker/nginx/Dockerfile
image: chill/activity-docs-person-report-task-nginx:${VERSION:-latest}
image: ${IMAGE_NGINX:-chill/activity-docs-person-report-task-nginx}:${VERSION:-latest}
volumes:
- .:/var/www/app
# - ./docker/nginx/nginx.conf:/etc/nginx/nginx.conf
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment