Skip to content

Instantly share code, notes, and snippets.

View wufe's full-sized avatar

Simone Bembi wufe

View GitHub Profile
@wufe
wufe / get-npm-package-version
Created October 9, 2016 17:05 — forked from DarrenN/get-npm-package-version
Extract version from package.json (NPM) using bash / shell
# Version key/value should be on his own line
PACKAGE_VERSION=$(cat package.json \
| grep version \
| head -1 \
| awk -F: '{ print $2 }' \
| sed 's/[",]//g')
echo $PACKAGE_VERSION
@wufe
wufe / Makefile
Created October 9, 2016 15:32
Log and command formatting for makefile
QUIET ?= false
RED := "\e[0;31m"
GREEN := "\e[0;32m"
DARKGREY := "\e[1;30m"
YELLOW := "\e[1;33m"
NC := "\e[0m"
INFO := @bash -c '\
printf $(YELLOW); \
@wufe
wufe / README.md
Created September 11, 2016 12:05 — forked from chadrien/README.md
Debug PHP in Docker with PHPStorm and Xdebug

Debug your PHP in Docker with Intellij/PHPStorm and Xdebug

  1. For your local dev, create a Dockerfile that is based on your production image and simply install xdebug into it. Exemple:
FROM php:5

RUN yes | pecl install xdebug \
&& echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.ini \
@wufe
wufe / Dockerfile
Last active February 25, 2024 21:18
Simple ansible dockerfile from "continuous delivery with docker and ansible" pluralsight course
FROM ubuntu:trusty
MAINTAINER Simone Bembi <simone.bembi@gmail.com>
# Prevent dpkg errors
ENV TERM=xterm-256color
# Install Ansible
RUN apt-get update -qy && \
apt-get install -qy software-properties-common && \
apt-add-repository -y ppa:ansible/ansible && \
@wufe
wufe / docker-compose.yml
Last active February 25, 2024 21:19
Sample docker-compose file used in "continuous delivery using docker and ansible" pluralsight course
test:
build: ../../
dockerfile: docker/dev/Dockerfile
volumes_from:
- cache
links:
- db
environment:
DJANGO_SETTINGS_MODULE: todobackend.settings.test
MYSQL_HOST: db
@wufe
wufe / VolumeContainer.MD
Last active September 8, 2016 05:33
Volume container built with docker using a dev sample image

Volume container built with docker using a dev sample image

Build the volume container overriding the entrypoint to "true".
This will not execute the default entrypoint of the image, and will terminate the container.
The volume will persist.
docker run -v /tmp/cache:/cache --entrypoint true --name cache sample-dev-image:latest

We now reference the volume when building the dev image.
docker run --rm --volumes-from cache sample-dev-image:latest

#!/bin/bash
# Activate virtual environment
. /appenv/bin/activate
# Install application test requirements
# The requirements.txt file can be generated with "pip freeze > requirements.txt"
# In order to include requirements.txt file to requirements_test.txt,
# a "-r requirements.txt" needs to be prepended.
pip install -r requirements_test.txt
@wufe
wufe / Dockerfile
Last active February 25, 2024 21:19
Dockerfile for creating python dev image, based upon previous made base image https://gist.github.com/Wufe/f0d530ceb34f71b83ecbba5833600125
# This image represents a reminder from the pluralsight's course "Countinuous delivery using docker and ansible"
# Requires test.sh available here https://gist.github.com/Wufe/5df9b9fcc121d4dfb96dbebab01663a1
FROM simone/base:latest
MAINTAINER Simone Bembi <simone.bembi@gmail.com>
# Install dev/build dependencies
RUN apt-get update && \
apt-get install -qy python-dev libmysqlclient-dev
@wufe
wufe / Dockerfile
Created September 7, 2016 21:08
Change apt list to nearer mirror
RUN sed -i "s/http:\/\/archive./http:\/\/it.archive./g" /etc/apt/sources.list
@wufe
wufe / entrypoint.sh
Created September 7, 2016 21:01
Entrypoint script for docker image containing python environment
#!/bin/bash
. /appenv/bin/activate
exec $@