From a5f9077e5a7d334e7ec84cedc4d8465ff1e2d910 Mon Sep 17 00:00:00 2001 From: Tiago Pires Date: Mon, 20 Jul 2015 14:53:53 +0100 Subject: Update docker image. Shrink docker image. Update from fig (deprecated) to docker-compose. Update README.md. Signed-off-by: Tiago Pires --- docker/README.md | 21 +++++++++------------ docker/assemble_blocks.sh | 16 ++++++++-------- docker/blocks/docker_gogs/Dockerfile | 15 ++++++--------- docker/blocks/docker_gogs_dev/Dockerfile | 20 ++++++++------------ docker/blocks/option_cache_memcache/docker-compose | 2 ++ docker/blocks/option_cache_memcache/fig | 2 -- docker/blocks/option_cache_redis/docker-compose | 2 ++ docker/blocks/option_cache_redis/fig | 2 -- docker/blocks/option_db_mysql/docker-compose | 7 +++++++ docker/blocks/option_db_mysql/fig | 7 ------- docker/blocks/option_db_postgresql/docker-compose | 6 ++++++ docker/blocks/option_db_postgresql/fig | 6 ------ docker/blocks/option_session_mysql/docker-compose | 7 +++++++ docker/blocks/option_session_mysql/fig | 7 ------- docker/blocks/w_cache/docker-compose | 6 ++++++ docker/blocks/w_cache/fig | 6 ------ docker/blocks/w_cache_session/docker-compose | 7 +++++++ docker/blocks/w_cache_session/fig | 7 ------- docker/blocks/w_db/docker-compose | 6 ++++++ docker/blocks/w_db/fig | 6 ------ docker/blocks/w_db_cache/docker-compose | 7 +++++++ docker/blocks/w_db_cache/fig | 7 ------- docker/blocks/w_db_cache_session/docker-compose | 8 ++++++++ docker/blocks/w_db_cache_session/fig | 8 -------- docker/blocks/w_db_session/docker-compose | 7 +++++++ docker/blocks/w_db_session/fig | 7 ------- docker/blocks/w_none/docker-compose | 4 ++++ docker/blocks/w_none/fig | 4 ---- docker/blocks/w_session/docker-compose | 6 ++++++ docker/blocks/w_session/fig | 6 ------ 30 files changed, 106 insertions(+), 116 deletions(-) create mode 100644 docker/blocks/option_cache_memcache/docker-compose delete mode 100644 docker/blocks/option_cache_memcache/fig create mode 100644 docker/blocks/option_cache_redis/docker-compose delete mode 100644 docker/blocks/option_cache_redis/fig create mode 100644 docker/blocks/option_db_mysql/docker-compose delete mode 100644 docker/blocks/option_db_mysql/fig create mode 100644 docker/blocks/option_db_postgresql/docker-compose delete mode 100644 docker/blocks/option_db_postgresql/fig create mode 100644 docker/blocks/option_session_mysql/docker-compose delete mode 100644 docker/blocks/option_session_mysql/fig create mode 100644 docker/blocks/w_cache/docker-compose delete mode 100644 docker/blocks/w_cache/fig create mode 100644 docker/blocks/w_cache_session/docker-compose delete mode 100644 docker/blocks/w_cache_session/fig create mode 100644 docker/blocks/w_db/docker-compose delete mode 100644 docker/blocks/w_db/fig create mode 100644 docker/blocks/w_db_cache/docker-compose delete mode 100644 docker/blocks/w_db_cache/fig create mode 100644 docker/blocks/w_db_cache_session/docker-compose delete mode 100644 docker/blocks/w_db_cache_session/fig create mode 100644 docker/blocks/w_db_session/docker-compose delete mode 100644 docker/blocks/w_db_session/fig create mode 100644 docker/blocks/w_none/docker-compose delete mode 100644 docker/blocks/w_none/fig create mode 100644 docker/blocks/w_session/docker-compose delete mode 100644 docker/blocks/w_session/fig (limited to 'docker') diff --git a/docker/README.md b/docker/README.md index 9f82cf76..2ef37271 100644 --- a/docker/README.md +++ b/docker/README.md @@ -3,13 +3,13 @@ Docker TOOLS ARE WRITTEN FOR TESTING AND TO SEE WHAT IT IS! -For this to work you will need the nifty docker tool [fig]. +For this to work you will need the nifty docker tool [docker-compose]. The most simple setup will look like this: ```sh ./assemble_blocks.sh docker_gogs w_db option_db_mysql -fig up +docker-compose up ``` @@ -22,21 +22,21 @@ How does it work ---------------- `./assemble_blocks.sh` will look in `blocks` for subdirectories. -In the subdirectories there are three relevant files: `Dockerfile`, `config` and `fig`. +In the subdirectories there are three relevant files: `Dockerfile`, `config` and `docker-compose`. `Dockerfile` will be copied to `docker/` (also means last `Dockerfile` wins). The `config` file contains lines which will in the gogs docker container end up in `$GOGS_PATH/custom/config/app.ini` and by this gogs will be configured. Here you can define things like the MySQL server for your database block. -The `fig` file will just be added to `fig.yml`, which is used by fig to manage your containers. +The `docker-compose` file will just be added to `docker-compose.yml`, which is used by docker-compose to manage your containers. This includes container linking! Just have a look at them and it will be clear how to write your own blocks. Just some things - - all files (`Dockerfile`, `fig` and `config`) are optional + - all files (`Dockerfile`, `docker-compose` and `config`) are optional - the gogs block should always be the first block Currently the blocks are designed that, the blocks that start with `docker` pull in the base docker image. @@ -57,14 +57,11 @@ Here is a more elaborated example ```sh ./assemble_blocks.sh docker_gogs w_db_cache_session option_db_postgresql option_cache_redis option_session_mysql -fig up +docker-compose up ``` This will set up four containters and link them proberly. One for each of - - - gogs - - database (postgresql) - - cache (redis) +docker-compose - session (mysql) WARNING: This will not work at the Moment! MySQL session is broken! @@ -73,7 +70,7 @@ WARNING: This will not work at the Moment! MySQL session is broken! Remark ------ -After you execute `assemble_blocks.sh` you should always trigger `fig build` to inculde the the new init script `init_gogs.sh` in the docker image. +After you execute `assemble_blocks.sh` you should always trigger `docker-compose build` to inculde the the new init script `init_gogs.sh` in the docker image. If you want to use another GoGS docker file, but keep everything else the same, you can create a block, e.g. `docker_gogs_custom`, with only a `Dockerfile` and call @@ -86,4 +83,4 @@ This will pull in the `Dockerfile` from `docker_gogs` instead of the one from `d `Dockerfile`s for the `master` and `dev` branch are provided as `docker_gogs` and `docker_gogs_dev` -[fig]:http://www.fig.sh/ +[docker-compose]:https://docs.docker.com/compose/ diff --git a/docker/assemble_blocks.sh b/docker/assemble_blocks.sh index 852064de..3109a6a0 100755 --- a/docker/assemble_blocks.sh +++ b/docker/assemble_blocks.sh @@ -10,8 +10,8 @@ gogs_config_file=conf.tmp gogs_config=config gogs_init_file=$docker_dir/init_gogs.sh -fig_file=fig.yml -fig_config=fig +compose_file=docker-compose.yml +compose_config=docker-compose gogs_init_template=$template_dir/init_gogs.sh.tpl @@ -28,7 +28,7 @@ if [ "$#" == 0 ]; then exit 0 fi -for file in $gogs_config_file $fig_file; do +for file in $gogs_config_file $compose_file; do if [ -e $file ]; then echo "Deleting $file" rm $file @@ -53,10 +53,10 @@ for dir in $@; do echo "" >> $gogs_config_file fi - if [ -e $current_dir/$fig_config ]; then - echo "Adding $current_dir/$fig_config to $fig_file" - cat $current_dir/fig >> $fig_file - echo "" >> $fig_file + if [ -e $current_dir/$compose_config ]; then + echo "Adding $current_dir/$compose_config to $compose_file" + cat $current_dir/$compose_config >> $compose_file + echo "" >> $compose_file fi done @@ -69,4 +69,4 @@ d if [ -e $gogs_config_file ]; then echo "Removing temporary GoGS config" rm $gogs_config_file -fi \ No newline at end of file +fi diff --git a/docker/blocks/docker_gogs/Dockerfile b/docker/blocks/docker_gogs/Dockerfile index efedc31a..1b58fbcf 100644 --- a/docker/blocks/docker_gogs/Dockerfile +++ b/docker/blocks/docker_gogs/Dockerfile @@ -1,23 +1,20 @@ -FROM ubuntu:14.04 +FROM buildpack-deps:trusty-scm # 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 openssh-client\ - --no-install-recommends + build-essential --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 curl -sSL https://golang.org/dl/go$GOLANG_VERSION.src.tar.gz \ + | tar -v -C /usr/src -xz -RUN cd src && ./make.bash --no-clean 2>&1 +RUN cd /usr/src/go/src && ./make.bash --no-clean 2>&1 ENV PATH /usr/src/go/bin:$PATH -RUN mkdir -p /go/src +RUN mkdir -p /go/src /go/bin && chmod -R 777 /go ENV GOPATH /go ENV PATH /go/bin:$PATH WORKDIR /go diff --git a/docker/blocks/docker_gogs_dev/Dockerfile b/docker/blocks/docker_gogs_dev/Dockerfile index ce653fbe..a51d165e 100644 --- a/docker/blocks/docker_gogs_dev/Dockerfile +++ b/docker/blocks/docker_gogs_dev/Dockerfile @@ -1,24 +1,20 @@ -FROM ubuntu:14.04 +FROM buildpack-deps:trusty-scm -# This part is derived from the official docker image ------------------ +# This part is taken from the official docker image -------------------- -RUN DEBIAN_FRONTEND=noninteractive apt-get update && \ - apt-get install -qy \ - build-essential ca-certificates curl \ - bzr git mercurial openssh-client\ - --no-install-recommends +RUN apt-get update && apt-get install -y \ + build-essential --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 curl -sSL https://golang.org/dl/go$GOLANG_VERSION.src.tar.gz \ + | tar -v -C /usr/src -xz -RUN cd src && ./make.bash --no-clean 2>&1 +RUN cd /usr/src/go/src && ./make.bash --no-clean 2>&1 ENV PATH /usr/src/go/bin:$PATH -RUN mkdir -p /go/src +RUN mkdir -p /go/src /go/bin && chmod -R 777 /go ENV GOPATH /go ENV PATH /go/bin:$PATH WORKDIR /go diff --git a/docker/blocks/option_cache_memcache/docker-compose b/docker/blocks/option_cache_memcache/docker-compose new file mode 100644 index 00000000..80d0215c --- /dev/null +++ b/docker/blocks/option_cache_memcache/docker-compose @@ -0,0 +1,2 @@ +cache: + image: sylvainlasnier/memcached:latest diff --git a/docker/blocks/option_cache_memcache/fig b/docker/blocks/option_cache_memcache/fig deleted file mode 100644 index 80d0215c..00000000 --- a/docker/blocks/option_cache_memcache/fig +++ /dev/null @@ -1,2 +0,0 @@ -cache: - image: sylvainlasnier/memcached:latest diff --git a/docker/blocks/option_cache_redis/docker-compose b/docker/blocks/option_cache_redis/docker-compose new file mode 100644 index 00000000..0e74bc4a --- /dev/null +++ b/docker/blocks/option_cache_redis/docker-compose @@ -0,0 +1,2 @@ +cache: + image: redis:latest diff --git a/docker/blocks/option_cache_redis/fig b/docker/blocks/option_cache_redis/fig deleted file mode 100644 index 0e74bc4a..00000000 --- a/docker/blocks/option_cache_redis/fig +++ /dev/null @@ -1,2 +0,0 @@ -cache: - image: redis:latest diff --git a/docker/blocks/option_db_mysql/docker-compose b/docker/blocks/option_db_mysql/docker-compose new file mode 100644 index 00000000..a005a059 --- /dev/null +++ b/docker/blocks/option_db_mysql/docker-compose @@ -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_mysql/fig b/docker/blocks/option_db_mysql/fig deleted file mode 100644 index a005a059..00000000 --- a/docker/blocks/option_db_mysql/fig +++ /dev/null @@ -1,7 +0,0 @@ -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/docker-compose b/docker/blocks/option_db_postgresql/docker-compose new file mode 100644 index 00000000..c839e904 --- /dev/null +++ b/docker/blocks/option_db_postgresql/docker-compose @@ -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_db_postgresql/fig b/docker/blocks/option_db_postgresql/fig deleted file mode 100644 index c839e904..00000000 --- a/docker/blocks/option_db_postgresql/fig +++ /dev/null @@ -1,6 +0,0 @@ -db: - image: wyaeld/postgres:9.3 - environment: - POSTGRESQL_DB: gogs - POSTGRESQL_USER: gogs - POSTGRESQL_PASS: password diff --git a/docker/blocks/option_session_mysql/docker-compose b/docker/blocks/option_session_mysql/docker-compose new file mode 100644 index 00000000..0e2dbf19 --- /dev/null +++ b/docker/blocks/option_session_mysql/docker-compose @@ -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/option_session_mysql/fig b/docker/blocks/option_session_mysql/fig deleted file mode 100644 index 0e2dbf19..00000000 --- a/docker/blocks/option_session_mysql/fig +++ /dev/null @@ -1,7 +0,0 @@ -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/docker-compose b/docker/blocks/w_cache/docker-compose new file mode 100644 index 00000000..fd66c357 --- /dev/null +++ b/docker/blocks/w_cache/docker-compose @@ -0,0 +1,6 @@ +gogs: + build: docker + links: + - cache + ports: + - "3000:3000" diff --git a/docker/blocks/w_cache/fig b/docker/blocks/w_cache/fig deleted file mode 100644 index fd66c357..00000000 --- a/docker/blocks/w_cache/fig +++ /dev/null @@ -1,6 +0,0 @@ -gogs: - build: docker - links: - - cache - ports: - - "3000:3000" diff --git a/docker/blocks/w_cache_session/docker-compose b/docker/blocks/w_cache_session/docker-compose new file mode 100644 index 00000000..0f901140 --- /dev/null +++ b/docker/blocks/w_cache_session/docker-compose @@ -0,0 +1,7 @@ +gogs: + build: docker + links: + - cache + - session + ports: + - "3000:3000" diff --git a/docker/blocks/w_cache_session/fig b/docker/blocks/w_cache_session/fig deleted file mode 100644 index 0f901140..00000000 --- a/docker/blocks/w_cache_session/fig +++ /dev/null @@ -1,7 +0,0 @@ -gogs: - build: docker - links: - - cache - - session - ports: - - "3000:3000" diff --git a/docker/blocks/w_db/docker-compose b/docker/blocks/w_db/docker-compose new file mode 100644 index 00000000..a7e9c1b6 --- /dev/null +++ b/docker/blocks/w_db/docker-compose @@ -0,0 +1,6 @@ +gogs: + build: docker + links: + - db + ports: + - "3000:3000" diff --git a/docker/blocks/w_db/fig b/docker/blocks/w_db/fig deleted file mode 100644 index a7e9c1b6..00000000 --- a/docker/blocks/w_db/fig +++ /dev/null @@ -1,6 +0,0 @@ -gogs: - build: docker - links: - - db - ports: - - "3000:3000" diff --git a/docker/blocks/w_db_cache/docker-compose b/docker/blocks/w_db_cache/docker-compose new file mode 100644 index 00000000..42402e40 --- /dev/null +++ b/docker/blocks/w_db_cache/docker-compose @@ -0,0 +1,7 @@ +gogs: + build: docker + links: + - db + - cache + ports: + - "3000:3000" diff --git a/docker/blocks/w_db_cache/fig b/docker/blocks/w_db_cache/fig deleted file mode 100644 index 42402e40..00000000 --- a/docker/blocks/w_db_cache/fig +++ /dev/null @@ -1,7 +0,0 @@ -gogs: - build: docker - links: - - db - - cache - ports: - - "3000:3000" diff --git a/docker/blocks/w_db_cache_session/docker-compose b/docker/blocks/w_db_cache_session/docker-compose new file mode 100644 index 00000000..42444405 --- /dev/null +++ b/docker/blocks/w_db_cache_session/docker-compose @@ -0,0 +1,8 @@ +gogs: + build: docker + links: + - db + - cache + - session + ports: + - "3000:3000" diff --git a/docker/blocks/w_db_cache_session/fig b/docker/blocks/w_db_cache_session/fig deleted file mode 100644 index 42444405..00000000 --- a/docker/blocks/w_db_cache_session/fig +++ /dev/null @@ -1,8 +0,0 @@ -gogs: - build: docker - links: - - db - - cache - - session - ports: - - "3000:3000" diff --git a/docker/blocks/w_db_session/docker-compose b/docker/blocks/w_db_session/docker-compose new file mode 100644 index 00000000..3703c6ba --- /dev/null +++ b/docker/blocks/w_db_session/docker-compose @@ -0,0 +1,7 @@ +gogs: + build: docker + links: + - db + - session + ports: + - "3000:3000" diff --git a/docker/blocks/w_db_session/fig b/docker/blocks/w_db_session/fig deleted file mode 100644 index 3703c6ba..00000000 --- a/docker/blocks/w_db_session/fig +++ /dev/null @@ -1,7 +0,0 @@ -gogs: - build: docker - links: - - db - - session - ports: - - "3000:3000" diff --git a/docker/blocks/w_none/docker-compose b/docker/blocks/w_none/docker-compose new file mode 100644 index 00000000..c0fed209 --- /dev/null +++ b/docker/blocks/w_none/docker-compose @@ -0,0 +1,4 @@ +gogs: + build: docker + ports: + - "3000:3000" diff --git a/docker/blocks/w_none/fig b/docker/blocks/w_none/fig deleted file mode 100644 index c0fed209..00000000 --- a/docker/blocks/w_none/fig +++ /dev/null @@ -1,4 +0,0 @@ -gogs: - build: docker - ports: - - "3000:3000" diff --git a/docker/blocks/w_session/docker-compose b/docker/blocks/w_session/docker-compose new file mode 100644 index 00000000..7dda0dde --- /dev/null +++ b/docker/blocks/w_session/docker-compose @@ -0,0 +1,6 @@ +gogs: + build: docker + links: + - session + ports: + - "3000:3000" diff --git a/docker/blocks/w_session/fig b/docker/blocks/w_session/fig deleted file mode 100644 index 7dda0dde..00000000 --- a/docker/blocks/w_session/fig +++ /dev/null @@ -1,6 +0,0 @@ -gogs: - build: docker - links: - - session - ports: - - "3000:3000" -- cgit v1.2.3