aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCody Hiar <codyfh@gmail.com>2018-03-21 16:44:04 -0600
committerCody Hiar <codyfh@gmail.com>2018-03-21 16:44:04 -0600
commitfdceedd5b753b580e29771a3a5f46538ffd41393 (patch)
tree4999ea4146fc559ddcde4a2c9416cbb70bbcffc7
initial commit
-rw-r--r--.gitignore1
-rw-r--r--README.md21
-rw-r--r--cookiecutter.json4
-rw-r--r--{{cookiecutter.project_name}}/.gitignore9
-rw-r--r--{{cookiecutter.project_name}}/Makefile22
-rw-r--r--{{cookiecutter.project_name}}/docker/Dockerfile24
-rw-r--r--{{cookiecutter.project_name}}/docker/entry.sh3
7 files changed, 84 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..ce3ed24
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+.vimcache
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..cf12615
--- /dev/null
+++ b/README.md
@@ -0,0 +1,21 @@
+CookieMan
+=========
+
+### How to use?
+
+This project is a template for kickstarting my projects. It uses cookiecutter
+which is a python module you can install with pip:
+
+```
+$ pip install cookiecutter
+```
+
+Then to start a new project simply call cookiecutter and supply the address of
+this repo:
+
+```
+$ cookiecutter https://github.com/thornycrackers/cookiecutter_docker.git
+```
+
+You will be prompted answer a couple questions about your project and then after
+that you will be ready to rock and roll.
diff --git a/cookiecutter.json b/cookiecutter.json
new file mode 100644
index 0000000..21ca891
--- /dev/null
+++ b/cookiecutter.json
@@ -0,0 +1,4 @@
+{
+ "project_name": "myprojectname",
+ "docker_namespace": "testing"
+}
diff --git a/{{cookiecutter.project_name}}/.gitignore b/{{cookiecutter.project_name}}/.gitignore
new file mode 100644
index 0000000..907670f
--- /dev/null
+++ b/{{cookiecutter.project_name}}/.gitignore
@@ -0,0 +1,9 @@
+.*.swp
+*.pyc
+*.pyo
+.DS_Store
+tags
+.ropeproject
+*.actual
+.vimcache
+.idea \ No newline at end of file
diff --git a/{{cookiecutter.project_name}}/Makefile b/{{cookiecutter.project_name}}/Makefile
new file mode 100644
index 0000000..921561c
--- /dev/null
+++ b/{{cookiecutter.project_name}}/Makefile
@@ -0,0 +1,22 @@
+.PHONY: build
+
+CONTAINERNAME={{cookiecutter.docker_namespace}}_{{cookiecutter.project_name}}
+IMAGENAME={{cookiecutter.docker_namespace}}/{{cookiecutter.project_name}}
+
+help:
+ @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
+
+build: ## Build the Docker image
+ docker build -t $(IMAGENAME) ./docker
+
+up: build ## Bring the container up
+ docker run -dP -v $(CURDIR):/app --name $(CONTAINERNAME) $(IMAGENAME) /bin/bash -c '/opt/entry.sh'
+
+down: ## Stop the container
+ docker stop $(CONTAINERNAME) || echo 'No container to stop'
+
+enter: ## Enter the running container
+ docker exec -it $(CONTAINERNAME) /bin/bash
+
+clean: down ## Remove the image and any stopped containers
+ docker rm $(CONTAINERNAME) || echo 'No container to remove'
diff --git a/{{cookiecutter.project_name}}/docker/Dockerfile b/{{cookiecutter.project_name}}/docker/Dockerfile
new file mode 100644
index 0000000..ebbbe32
--- /dev/null
+++ b/{{cookiecutter.project_name}}/docker/Dockerfile
@@ -0,0 +1,24 @@
+FROM ubuntu:16.04
+
+# Set a term for terminal inside the container, can't clear without it
+ENV TERM screen-256color
+ENV DEBIAN_FRONTEND noninteractive
+
+
+# Update and install
+RUN apt-get update && apt-get install -y \
+ wget \
+ locales
+
+# Generally a good idea to have these, extensions sometimes need them
+RUN locale-gen en_US.UTF-8
+ENV LANG en_US.UTF-8
+ENV LANGUAGE en_US:en
+ENV LC_ALL en_US.UTF-8
+
+# The code should be symlinked to this directory
+WORKDIR /app
+
+# Create the entry script
+ADD entry.sh /opt/
+RUN chmod 755 /opt/entry.sh
diff --git a/{{cookiecutter.project_name}}/docker/entry.sh b/{{cookiecutter.project_name}}/docker/entry.sh
new file mode 100644
index 0000000..09a943f
--- /dev/null
+++ b/{{cookiecutter.project_name}}/docker/entry.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+while true; do echo hi; sleep 1; done;