From d1a2228f1cc1b0bec7023d226077e4002c07112a Mon Sep 17 00:00:00 2001 From: Tristan Storch Date: Fri, 29 Aug 2014 18:20:15 +0200 Subject: Docker mix and match setup Rewrite of the docker setup. Now uses fig to manage containers and container linkage. The base is a block based mix and match, which will give you the possibility to easily test all configurations. --- docker/blocks/docker_gogs/Dockerfile | 52 ++++++++++++++++++++++++++++++ docker/blocks/docker_gogs_dev/Dockerfile | 52 ++++++++++++++++++++++++++++++ docker/blocks/option_cache_memcache/config | 3 ++ docker/blocks/option_cache_memcache/fig | 2 ++ docker/blocks/option_cache_redis/config | 3 ++ docker/blocks/option_cache_redis/fig | 2 ++ docker/blocks/option_db_mysql/config | 6 ++++ docker/blocks/option_db_mysql/fig | 7 ++++ docker/blocks/option_db_postgresql/config | 6 ++++ docker/blocks/option_db_postgresql/fig | 6 ++++ docker/blocks/option_session_mysql/config | 3 ++ docker/blocks/option_session_mysql/fig | 7 ++++ docker/blocks/w_cache/fig | 6 ++++ docker/blocks/w_cache_session/fig | 7 ++++ docker/blocks/w_db/fig | 6 ++++ docker/blocks/w_db_cache/fig | 7 ++++ docker/blocks/w_db_cache_session/fig | 8 +++++ docker/blocks/w_db_session/fig | 7 ++++ docker/blocks/w_none/fig | 4 +++ docker/blocks/w_session/fig | 6 ++++ 20 files changed, 200 insertions(+) create mode 100644 docker/blocks/docker_gogs/Dockerfile create mode 100644 docker/blocks/docker_gogs_dev/Dockerfile create mode 100644 docker/blocks/option_cache_memcache/config create mode 100644 docker/blocks/option_cache_memcache/fig create mode 100644 docker/blocks/option_cache_redis/config create mode 100644 docker/blocks/option_cache_redis/fig create mode 100644 docker/blocks/option_db_mysql/config create mode 100644 docker/blocks/option_db_mysql/fig create mode 100644 docker/blocks/option_db_postgresql/config create mode 100644 docker/blocks/option_db_postgresql/fig create mode 100644 docker/blocks/option_session_mysql/config create mode 100644 docker/blocks/option_session_mysql/fig create mode 100644 docker/blocks/w_cache/fig create mode 100644 docker/blocks/w_cache_session/fig create mode 100644 docker/blocks/w_db/fig create mode 100644 docker/blocks/w_db_cache/fig create mode 100644 docker/blocks/w_db_cache_session/fig create mode 100644 docker/blocks/w_db_session/fig create mode 100644 docker/blocks/w_none/fig create mode 100644 docker/blocks/w_session/fig (limited to 'docker/blocks') diff --git a/docker/blocks/docker_gogs/Dockerfile b/docker/blocks/docker_gogs/Dockerfile new file mode 100644 index 00000000..e2e056ae --- /dev/null +++ b/docker/blocks/docker_gogs/Dockerfile @@ -0,0 +1,52 @@ +FROM ubuntu:14.04 + +# This part is taken from the official docker image -------------------- + +RUN apt-get update && apt-get install -y \ + build-essential ca-certificates curl \ + bzr git mercurial \ + --no-install-recommends + +ENV GOLANG_VERSION 1.3 + +RUN curl -sSL http://golang.org/dl/go$GOLANG_VERSION.src.tar.gz \ + | tar -v -C /usr/src -xz +WORKDIR /usr/src/go + +RUN cd src && ./make.bash --no-clean 2>&1 + +ENV PATH /usr/src/go/bin:$PATH + +RUN mkdir -p /go/src +ENV GOPATH /go +ENV PATH /go/bin:$PATH +WORKDIR /go + +# ---------------------------------------------------------------------- + + +RUN useradd -m git + +ENV GOGS_PATH $GOPATH/src/github.com/gogits/gogs +ENV GOGS_CUSTOM_CONF_PATH $GOGS_PATH/custom/conf +ENV GOGS_CUSTOM_CONF $GOGS_CUSTOM_CONF_PATH/app.ini + +RUN go get -u -d github.com/gogits/gogs +# WORKDIR $GOGS_PATH +WORKDIR /go/src/github.com/gogits/gogs +RUN go build github.com/gogits/gogs +RUN chown -R git $GOGS_PATH + +ADD init_gogs.sh /tmp/ +RUN chown git /tmp/init_gogs.sh +RUN chmod +x /tmp/init_gogs.sh + +USER git +ENV HOME /home/git +ENV USER git +ENV PATH $GOGS_PATH:$PATH + +RUN git config --global user.name "GoGS" + +ENTRYPOINT ["/tmp/init_gogs.sh"] +CMD ["gogs", "web"] diff --git a/docker/blocks/docker_gogs_dev/Dockerfile b/docker/blocks/docker_gogs_dev/Dockerfile new file mode 100644 index 00000000..1c001e2c --- /dev/null +++ b/docker/blocks/docker_gogs_dev/Dockerfile @@ -0,0 +1,52 @@ +FROM ubuntu:14.04 + +# This part is taken from the official docker image -------------------- + +RUN apt-get update && apt-get install -y \ + build-essential ca-certificates curl \ + bzr git mercurial \ + --no-install-recommends + +ENV GOLANG_VERSION 1.3 + +RUN curl -sSL http://golang.org/dl/go$GOLANG_VERSION.src.tar.gz \ + | tar -v -C /usr/src -xz +WORKDIR /usr/src/go + +RUN cd src && ./make.bash --no-clean 2>&1 + +ENV PATH /usr/src/go/bin:$PATH + +RUN mkdir -p /go/src +ENV GOPATH /go +ENV PATH /go/bin:$PATH +WORKDIR /go + +# ---------------------------------------------------------------------- + + +RUN useradd -m git + +ENV GOGS_PATH $GOPATH/src/github.com/gogits/gogs +ENV GOGS_CUSTOM_CONF_PATH $GOGS_PATH/custom/conf +ENV GOGS_CUSTOM_CONF $GOGS_CUSTOM_CONF_PATH/app.ini + +RUN go get -u -d github.com/gogits/gogs +# WORKDIR $GOGS_PATH +WORKDIR /go/src/github.com/gogits/gogs +RUN git checkout dev; go get -u; git checkout dev; go build +RUN chown -R git $GOGS_PATH + +ADD init_gogs.sh /tmp/ +RUN chown git /tmp/init_gogs.sh +RUN chmod +x /tmp/init_gogs.sh + +USER git +ENV HOME /home/git +ENV USER git +ENV PATH $GOGS_PATH:$PATH + +RUN git config --global user.name "GoGS" + +ENTRYPOINT ["/tmp/init_gogs.sh"] +CMD ["gogs", "web"] diff --git a/docker/blocks/option_cache_memcache/config b/docker/blocks/option_cache_memcache/config new file mode 100644 index 00000000..daca6f3e --- /dev/null +++ b/docker/blocks/option_cache_memcache/config @@ -0,0 +1,3 @@ +[cache] +DB_TYPE = memcache +HOST = HOST = ${CACHE_1_PORT_11211_TCP_ADDR}:${CACHE_1_PORT_11211_TCP_PORT} diff --git a/docker/blocks/option_cache_memcache/fig b/docker/blocks/option_cache_memcache/fig new file mode 100644 index 00000000..80d0215c --- /dev/null +++ b/docker/blocks/option_cache_memcache/fig @@ -0,0 +1,2 @@ +cache: + image: sylvainlasnier/memcached:latest diff --git a/docker/blocks/option_cache_redis/config b/docker/blocks/option_cache_redis/config new file mode 100644 index 00000000..648f4f38 --- /dev/null +++ b/docker/blocks/option_cache_redis/config @@ -0,0 +1,3 @@ +[cache] +DB_TYPE = redis +HOST = ${CACHE_1_PORT_6379_TCP_ADDR}:${CACHE_1_PORT_6379_TCP_PORT} diff --git a/docker/blocks/option_cache_redis/fig b/docker/blocks/option_cache_redis/fig new file mode 100644 index 00000000..0e74bc4a --- /dev/null +++ b/docker/blocks/option_cache_redis/fig @@ -0,0 +1,2 @@ +cache: + image: redis:latest diff --git a/docker/blocks/option_db_mysql/config b/docker/blocks/option_db_mysql/config new file mode 100644 index 00000000..53f8949d --- /dev/null +++ b/docker/blocks/option_db_mysql/config @@ -0,0 +1,6 @@ +[database] +DB_TYPE = mysql +HOST = ${DB_1_PORT_3306_TCP_ADDR}:${DB_1_PORT_3306_TCP_PORT} +NAME = ${DB_1_ENV_MYSQL_DATABASE} +USER = ${DB_1_ENV_MYSQL_USER} +PASSWD = ${DB_1_ENV_MYSQL_PASSWORD} diff --git a/docker/blocks/option_db_mysql/fig b/docker/blocks/option_db_mysql/fig new file mode 100644 index 00000000..a005a059 --- /dev/null +++ b/docker/blocks/option_db_mysql/fig @@ -0,0 +1,7 @@ +db: + image: mysql:latest + environment: + MYSQL_ROOT_PASSWORD: rootpass + MYSQL_DATABASE: gogs + MYSQL_USER: gogs + MYSQL_PASSWORD: password diff --git a/docker/blocks/option_db_postgresql/config b/docker/blocks/option_db_postgresql/config new file mode 100644 index 00000000..e5946b06 --- /dev/null +++ b/docker/blocks/option_db_postgresql/config @@ -0,0 +1,6 @@ +[database] +DB_TYPE = postgres +HOST = ${DB_1_PORT_5432_TCP_ADDR}:${DB_1_PORT_5432_TCP_PORT} +NAME = ${DB_1_ENV_POSTGRESQL_DB} +USER = ${DB_1_ENV_POSTGRESQL_USER} +PASSWD = ${DB_1_ENV_POSTGRESQL_PASS} diff --git a/docker/blocks/option_db_postgresql/fig b/docker/blocks/option_db_postgresql/fig new file mode 100644 index 00000000..c839e904 --- /dev/null +++ b/docker/blocks/option_db_postgresql/fig @@ -0,0 +1,6 @@ +db: + image: wyaeld/postgres:9.3 + environment: + POSTGRESQL_DB: gogs + POSTGRESQL_USER: gogs + POSTGRESQL_PASS: password diff --git a/docker/blocks/option_session_mysql/config b/docker/blocks/option_session_mysql/config new file mode 100644 index 00000000..b8bc2cc7 --- /dev/null +++ b/docker/blocks/option_session_mysql/config @@ -0,0 +1,3 @@ +[session] +PROVIDER = mysql +PROVIDER_CONFIG = ${SESSION_1_ENV_MYSQL_USER}:${SESSION_1_ENV_MYSQL_PASSWORD}@SESSION_1_PORT_3306_TCP_PROTO(${SESSION_1_PORT_3306_TCP_ADDR}:${SESSION_1_PORT_3306_TCP_PORT})/${SESSION_1_ENV_MYSQL_DATABASE} diff --git a/docker/blocks/option_session_mysql/fig b/docker/blocks/option_session_mysql/fig new file mode 100644 index 00000000..0e2dbf19 --- /dev/null +++ b/docker/blocks/option_session_mysql/fig @@ -0,0 +1,7 @@ +session: + image: mysql:latest + environment: + MYSQL_ROOT_PASSWORD: rootpass + MYSQL_DATABASE: gogs_session + MYSQL_USER: gogs + MYSQL_PASSWORD: password diff --git a/docker/blocks/w_cache/fig b/docker/blocks/w_cache/fig new file mode 100644 index 00000000..fd66c357 --- /dev/null +++ b/docker/blocks/w_cache/fig @@ -0,0 +1,6 @@ +gogs: + build: docker + links: + - cache + ports: + - "3000:3000" diff --git a/docker/blocks/w_cache_session/fig b/docker/blocks/w_cache_session/fig new file mode 100644 index 00000000..0f901140 --- /dev/null +++ b/docker/blocks/w_cache_session/fig @@ -0,0 +1,7 @@ +gogs: + build: docker + links: + - cache + - session + ports: + - "3000:3000" diff --git a/docker/blocks/w_db/fig b/docker/blocks/w_db/fig new file mode 100644 index 00000000..a7e9c1b6 --- /dev/null +++ b/docker/blocks/w_db/fig @@ -0,0 +1,6 @@ +gogs: + build: docker + links: + - db + ports: + - "3000:3000" diff --git a/docker/blocks/w_db_cache/fig b/docker/blocks/w_db_cache/fig new file mode 100644 index 00000000..42402e40 --- /dev/null +++ b/docker/blocks/w_db_cache/fig @@ -0,0 +1,7 @@ +gogs: + build: docker + links: + - db + - cache + ports: + - "3000:3000" diff --git a/docker/blocks/w_db_cache_session/fig b/docker/blocks/w_db_cache_session/fig new file mode 100644 index 00000000..42444405 --- /dev/null +++ b/docker/blocks/w_db_cache_session/fig @@ -0,0 +1,8 @@ +gogs: + build: docker + links: + - db + - cache + - session + ports: + - "3000:3000" diff --git a/docker/blocks/w_db_session/fig b/docker/blocks/w_db_session/fig new file mode 100644 index 00000000..3703c6ba --- /dev/null +++ b/docker/blocks/w_db_session/fig @@ -0,0 +1,7 @@ +gogs: + build: docker + links: + - db + - session + ports: + - "3000:3000" diff --git a/docker/blocks/w_none/fig b/docker/blocks/w_none/fig new file mode 100644 index 00000000..c0fed209 --- /dev/null +++ b/docker/blocks/w_none/fig @@ -0,0 +1,4 @@ +gogs: + build: docker + ports: + - "3000:3000" diff --git a/docker/blocks/w_session/fig b/docker/blocks/w_session/fig new file mode 100644 index 00000000..7dda0dde --- /dev/null +++ b/docker/blocks/w_session/fig @@ -0,0 +1,6 @@ +gogs: + build: docker + links: + - session + ports: + - "3000:3000" -- cgit v1.2.3 From 7df0794e14e713d359ee79d204d75cc574b02c1f Mon Sep 17 00:00:00 2001 From: Tristan Storch Date: Wed, 3 Sep 2014 17:12:38 +0200 Subject: docker dev block update The dev Dockerfile now works without superfluous go get calls. At this point the -u option is really not what we want. --- docker/blocks/docker_gogs_dev/Dockerfile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'docker/blocks') diff --git a/docker/blocks/docker_gogs_dev/Dockerfile b/docker/blocks/docker_gogs_dev/Dockerfile index 1c001e2c..a016409f 100644 --- a/docker/blocks/docker_gogs_dev/Dockerfile +++ b/docker/blocks/docker_gogs_dev/Dockerfile @@ -1,8 +1,9 @@ FROM ubuntu:14.04 -# This part is taken from the official docker image -------------------- +# This part is derived from the official docker image ------------------ -RUN apt-get update && apt-get install -y \ +RUN DEBIAN_FRONTEND=noninteractive apt-get update && \ + apt-get install -qy \ build-essential ca-certificates curl \ bzr git mercurial \ --no-install-recommends @@ -31,10 +32,10 @@ ENV GOGS_PATH $GOPATH/src/github.com/gogits/gogs ENV GOGS_CUSTOM_CONF_PATH $GOGS_PATH/custom/conf ENV GOGS_CUSTOM_CONF $GOGS_CUSTOM_CONF_PATH/app.ini -RUN go get -u -d github.com/gogits/gogs +RUN git clone -b dev https://github.com/gogits/gogs.git $GOPATH/src/github.com/gogits/gogs # WORKDIR $GOGS_PATH WORKDIR /go/src/github.com/gogits/gogs -RUN git checkout dev; go get -u; git checkout dev; go build +RUN go get -d && go build RUN chown -R git $GOGS_PATH ADD init_gogs.sh /tmp/ -- cgit v1.2.3 From 863a4d5bc4b1e1237e259325ac30c111755c9a02 Mon Sep 17 00:00:00 2001 From: Tristan Storch Date: Wed, 3 Sep 2014 18:41:20 +0200 Subject: Use variables, when the're there Why not use the environment variables, when they are there... --- docker/blocks/docker_gogs_dev/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docker/blocks') diff --git a/docker/blocks/docker_gogs_dev/Dockerfile b/docker/blocks/docker_gogs_dev/Dockerfile index a016409f..d1b96bf4 100644 --- a/docker/blocks/docker_gogs_dev/Dockerfile +++ b/docker/blocks/docker_gogs_dev/Dockerfile @@ -32,7 +32,7 @@ ENV GOGS_PATH $GOPATH/src/github.com/gogits/gogs ENV GOGS_CUSTOM_CONF_PATH $GOGS_PATH/custom/conf ENV GOGS_CUSTOM_CONF $GOGS_CUSTOM_CONF_PATH/app.ini -RUN git clone -b dev https://github.com/gogits/gogs.git $GOPATH/src/github.com/gogits/gogs +RUN git clone -b dev https://github.com/gogits/gogs.git $GOGS_PATH # WORKDIR $GOGS_PATH WORKDIR /go/src/github.com/gogits/gogs RUN go get -d && go build -- cgit v1.2.3