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.
This commit is contained in:
Tristan Storch
2014-08-29 18:20:15 +02:00
parent 2886eb76b6
commit d1a2228f1c
25 changed files with 373 additions and 40 deletions

View File

@ -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"]

View File

@ -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"]

View File

@ -0,0 +1,3 @@
[cache]
DB_TYPE = memcache
HOST = HOST = ${CACHE_1_PORT_11211_TCP_ADDR}:${CACHE_1_PORT_11211_TCP_PORT}

View File

@ -0,0 +1,2 @@
cache:
image: sylvainlasnier/memcached:latest

View File

@ -0,0 +1,3 @@
[cache]
DB_TYPE = redis
HOST = ${CACHE_1_PORT_6379_TCP_ADDR}:${CACHE_1_PORT_6379_TCP_PORT}

View File

@ -0,0 +1,2 @@
cache:
image: redis:latest

View File

@ -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}

View File

@ -0,0 +1,7 @@
db:
image: mysql:latest
environment:
MYSQL_ROOT_PASSWORD: rootpass
MYSQL_DATABASE: gogs
MYSQL_USER: gogs
MYSQL_PASSWORD: password

View File

@ -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}

View File

@ -0,0 +1,6 @@
db:
image: wyaeld/postgres:9.3
environment:
POSTGRESQL_DB: gogs
POSTGRESQL_USER: gogs
POSTGRESQL_PASS: password

View File

@ -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}

View File

@ -0,0 +1,7 @@
session:
image: mysql:latest
environment:
MYSQL_ROOT_PASSWORD: rootpass
MYSQL_DATABASE: gogs_session
MYSQL_USER: gogs
MYSQL_PASSWORD: password

View File

@ -0,0 +1,6 @@
gogs:
build: docker
links:
- cache
ports:
- "3000:3000"

View File

@ -0,0 +1,7 @@
gogs:
build: docker
links:
- cache
- session
ports:
- "3000:3000"

6
docker/blocks/w_db/fig Normal file
View File

@ -0,0 +1,6 @@
gogs:
build: docker
links:
- db
ports:
- "3000:3000"

View File

@ -0,0 +1,7 @@
gogs:
build: docker
links:
- db
- cache
ports:
- "3000:3000"

View File

@ -0,0 +1,8 @@
gogs:
build: docker
links:
- db
- cache
- session
ports:
- "3000:3000"

View File

@ -0,0 +1,7 @@
gogs:
build: docker
links:
- db
- session
ports:
- "3000:3000"

4
docker/blocks/w_none/fig Normal file
View File

@ -0,0 +1,4 @@
gogs:
build: docker
ports:
- "3000:3000"

View File

@ -0,0 +1,6 @@
gogs:
build: docker
links:
- session
ports:
- "3000:3000"