sioaji2012のブログ

普段は組み込み開発でC言語のみです。主にプログラムや勉強日記です

Redmineプラグインもくもく会 山梨 #002回 開発環境

前回の続き

引数でバージョンを切り替える様に出来るか検討しよう。

docker-compose.ymlを引数対応に戻します。

REDMINE_VERSION: 3.4-stable

⬇

REDMINE_VERSION: $REDMINE_VERSION

3.3-stable を試す

3.3-stable は、ruby 2.3までしか対応していないので、Dockerfileを修正。 動作環境はこちら*1で調べた。

Dockerfile

FROM ruby:2.4.2

⬇

FROM ruby:2.2.2

起動

$ REDMINE_VERSION=3.3-stable docker-compose build --no-cache
$ docker-compose up -d

http://localhost:3000 でredmineの起動確認 3.3-stableでRedmineが起動出来た。

タグ指定で起動する

会社のバージョンで起動したい。tag 3.3.2/ ruby 2.1.10

Dockerfile

FROM ruby:2.2.2

RUN cd /tmp && git clone --depth 1 -b ${REDMINE_VERSION} https://github.com/redmine/redmine redmine

⬇

FROM ruby:2.1.10

RUN cd /tmp && git clone --depth 1 -b ${REDMINE_VERSION} --single-branch https://github.com/redmine/redmine redmine

起動

$ REDMINE_VERSION=3.3.2 docker-compose build --no-cache
$ docker-compose up -d

http://localhost:3000 でredmineの起動確認 3.3.2でRedmineが起動出来た。

Environment:
  Redmine version                3.3.2.stable
  Ruby version                   2.1.10-p492 (2016-04-01) [x86_64-linux]
  Rails version                  4.2.7.1
  Environment                    development
  Database adapter               SQLite
SCM:
  Subversion                     1.8.10
  Mercurial                      3.1.2
  Bazaar                         2.7.0
  Git                            2.1.4
  Filesystem                     
Redmine plugins:
  no plugin installed

※Git clone でのタグの指定方法は良く知らないので、少し不安があります。 実際に下記の様に、注意ログが表示されています。

Step 7/16 : RUN cd /tmp && git clone --depth 1 -b ${REDMINE_VERSION} --single-branch https://github.com/redmine/redmine redmine
 ---> Running in a61fdf32f412
Cloning into 'redmine'...
Note: checking out '7827d9cdf8c0f198b776bcd88881a57d83390ee1'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b new_branch_name

Removing intermediate container a61fdf32f412
 ---> a81d4d34b36b

次回は、このイメージを使って、プラグイン開発する方法を考える

結局、Dockerの勉強が必要になるかも。