Help us understand the problem. What is going on with this article?

Drone CI Open Source Edition のコンテナイメージをビルドする

Docker Hub に用意されているものは Enterprise Edition のため、一定規模以上での無償利用にはビルド数に制限がある。機能は少ないが制限なしで使える Open Source Edition をコンテナで動作させる。

環境

ビルド手順

Drone Server のビルド

BUILDING_OSS を参考にビルドする。

デフォルトのビルドは glibc にダイナミックリンクされるため、素の alpine 上では動作しない。そのため、-ldflags "-extldflags \"-static\"" をつけてスタティックリンクする。以下は golang コンテナで drone-server をビルドする例。

$ DRONE_VERSION=1.6.0
$ git clone -b v${DRONE_VERSION} https://github.com/drone/drone drone_${DRONE_VERSION}
$ cd drone_${DRONE_VERSION}
$ docker run -it -v `pwd`:/src golang bash
# cd /src
# go build -tags "oss nolimit" \
    -ldflags "-extldflags \"-static\"" \
    -o release/linux/amd64/drone-server \
    github.com/drone/drone/cmd/drone-server
# exit

Docker イメージ作成

Dockerfile.server.linux.amd64 を参考に Dockerfile を作成する。(Datadog は無効化したくらい。)

# docker build --rm -f docker/Dockerfile -t drone/drone .

FROM alpine:3.9 as alpine
RUN apk add -U --no-cache ca-certificates

FROM alpine:3.9
EXPOSE 80 443
VOLUME /data

RUN [ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf

ENV GODEBUG netdns=go
ENV XDG_CACHE_HOME /data
ENV DRONE_DATABASE_DRIVER sqlite3
ENV DRONE_DATABASE_DATASOURCE /data/database.sqlite
ENV DRONE_RUNNER_OS=linux
ENV DRONE_RUNNER_ARCH=amd64
ENV DRONE_SERVER_PORT=:80
ENV DRONE_SERVER_HOST=localhost
#ENV DRONE_DATADOG_ENABLED=true
#ENV DRONE_DATADOG_ENDPOINT=https://stats.drone.ci/api/v1/series

COPY --from=alpine /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/

ADD release/linux/amd64/drone-server /bin/
ENTRYPOINT ["/bin/drone-server"]

ビルドする。

$ docker build -t drone${DRONE_VERSION} .
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした