From f416ab2f81f2f02f9a55274e63333b6964ce9da1 Mon Sep 17 00:00:00 2001 From: Bryan Hyshka Date: Mon, 5 Mar 2018 11:04:01 -0700 Subject: add basic dockerfile setup --- .gitignore | 2 ++ Makefile | 25 +++++++++++++++++++++++++ build/Dockerfile | 31 +++++++++++++++++++++++++++++++ build/entry.sh | 3 +++ 4 files changed, 61 insertions(+) create mode 100644 Makefile create mode 100644 build/Dockerfile create mode 100644 build/entry.sh diff --git a/.gitignore b/.gitignore index f362d03..ab9362c 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ .mypy_cache __pycache__ config.json +build/config.json +build/requirements.txt diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..97e4d39 --- /dev/null +++ b/Makefile @@ -0,0 +1,25 @@ +.PHONY: build + +SHELL := /bin/bash +CONTAINERNAME=accli +IMAGENAME=accli + +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 + cp -r requirements.txt ./build + cp -r config.json ./build + docker build -t $(IMAGENAME) ./build + +up: build ## Bring the Docker container up + docker run -td -v $(PWD):/opt --name $(CONTAINERNAME) $(IMAGENAME) || echo 'Already up!' + +down: ## Stop the Docker container + docker stop $(CONTAINERNAME) + +enter: ## Enter the running Docker container + docker exec -it $(CONTAINERNAME) /bin/bash + +clean: down ## Stop and remove Docker container + docker rm $(CONTAINERNAME) diff --git a/build/Dockerfile b/build/Dockerfile new file mode 100644 index 0000000..e31cb36 --- /dev/null +++ b/build/Dockerfile @@ -0,0 +1,31 @@ +FROM ubuntu:16.04 +MAINTAINER Cody Hiar + +# Needed for better experience in container terminal +ENV TERM=xterm-256color + +# Update and install +RUN apt-get update && apt-get install -y \ + git \ + wget \ + # for cal utility + bsdmainutils \ + # Python + python3-dev \ + python3-pip + +# Add the project requirements +ADD requirements.txt /opt/requirements.txt + +# # Install the requirements, remove 3 for wagtail +RUN /bin/bash -c 'cd /opt \ + && pip3 install -r requirements.txt' + +ADD config.json /opt/config.json + +# change to /opt for the working directory, you should mount the local dir volume here +WORKDIR /opt + +# Add the entry script +ADD entry.sh /opt/ +RUN chmod 755 /opt/entry.sh diff --git a/build/entry.sh b/build/entry.sh new file mode 100644 index 0000000..09a943f --- /dev/null +++ b/build/entry.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +while true; do echo hi; sleep 1; done; -- cgit v1.2.3