Переглянути джерело

added scripts and dockerfiles

Harlan Iverson 7 роки тому
батько
коміт
a648a71087

+ 7 - 0
harlanji.com/Dockerfile

@@ -0,0 +1,7 @@
+FROM cryogen:8-jdk_1.8_2.8.1
+
+ADD app/project.clj /tmp/app/project.clj
+RUN lein deps
+
+RUN rm -rf /tmp/app
+ADD app /tmp/app

+ 10 - 0
harlanji.com/Dockerfile.static

@@ -0,0 +1,10 @@
+FROM alpine
+
+RUN apk update && apk upgrade && apk add python
+
+WORKDIR /tmp/http
+ADD app/resources/public /tmp/http
+
+EXPOSE 9090
+
+CMD ["python", "-m", "SimpleHTTPServer", "9090"]

+ 5 - 0
harlanji.com/scripts/build-build.sh

@@ -0,0 +1,5 @@
+#!/bin/bash
+
+source scripts/env.sh
+
+docker build -t $IMAGE .

+ 6 - 0
harlanji.com/scripts/build-static.sh

@@ -0,0 +1,6 @@
+#!/bin/bash
+
+source scripts/env.sh
+
+docker build -t $IMAGE_STATIC_LOCAL -f Dockerfile.static .
+docker tag $IMAGE_STATIC_LOCAL $IMAGE_STATIC

+ 18 - 0
harlanji.com/scripts/env.sh

@@ -0,0 +1,18 @@
+#!/bin/bash
+
+# use with source
+
+IMAGE=harlanji-build
+NAME=harlanji-build
+DEV_PORT=34000
+STATIC_PORT=34080
+
+
+DOMAIN=harlanji.com
+HOSTS=#$DOMAIN
+
+
+NAME_STATIC=harlanji-static
+IMAGE_STATIC_LOCAL=harlanji-static
+
+IMAGE_STATIC=docker-registry.local:5000/harlanji.com/harlanji-static:1

+ 3 - 0
harlanji.com/scripts/fix-website.sh

@@ -0,0 +1,3 @@
+#!/bin/bash
+
+scripts/build-static.sh && (scripts/stop-static.sh ; scripts/start-static.sh)

+ 8 - 0
harlanji.com/scripts/start-build.sh

@@ -0,0 +1,8 @@
+#!/bin/bash
+
+source scripts/env.sh
+
+docker run -d --restart always \
+-v $PWD/app:/tmp/app \
+--name $NAME -p $DEV_PORT:3000 \
+$IMAGE

+ 9 - 0
harlanji.com/scripts/start-static.sh

@@ -0,0 +1,9 @@
+#!/bin/bash
+
+source scripts/env.sh
+
+
+docker run -d --restart always  \
+  --name $NAME_STATIC \
+  -p $STATIC_PORT:9090 \
+  $IMAGE_STATIC

+ 5 - 0
harlanji.com/scripts/stop-build.sh

@@ -0,0 +1,5 @@
+#!/bin/bash
+
+source scripts/env.sh
+
+docker rm -f $NAME

+ 5 - 0
harlanji.com/scripts/stop-static.sh

@@ -0,0 +1,5 @@
+#!/bin/bash
+
+source scripts/env.sh
+
+docker rm -f $NAME_STATIC

+ 5 - 0
harlanji.com/scripts/tail-build-log.sh

@@ -0,0 +1,5 @@
+#!/bin/bash
+
+source scripts/env.sh
+
+docker logs --since=1m --follow $NAME