1
0

More than 3 years have passed since last update.

Ubuntu12.04 用の go build を行う

Posted at

やむを得ない事情で古代の Ubuntu で使用するための Go 製アプリのビルドを行う方法。

1. Ubuntu12.04 の Docker イメージを用意する

$ docker run --rm  -it -v $(pwd):/home/ubuntu ubuntu:12.04 bash

以降は Docker 内での操作

2. 必要なツールのインストール

# apt-get update
# apt-get install wget git

3. Go のインストール

インストールするバージョン(今回は1.10)は状況に合わせて変更。

# wget http://golang.org/dl/go1.10.linux-amd64.tar.gz
# tar -C /usr/local -xzf go1.10.linux-amd64.tar.gz
# export PATH=/usr/local/go/bin:$PATH
# go version

4. 必要なツールのインストールとビルド

# cd /home/ubuntu
# go get github.com/hoge/fuga
# git clone github.com/foo/foo
# cd foo
# go build

あとはマウントしたホスト側フォルダからビルドしたバイナリを取得して scp なり rsync で目的のサーバーにコピーして起動する。

参考

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0