-
Notifications
You must be signed in to change notification settings - Fork 18
/
Dockerfile
51 lines (36 loc) · 1.43 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
FROM ubuntu:20.04 as base
MAINTAINER Joan Vega <joan@wetopi.com>
ENV GO_VERSION 1.16
ENV CEPH_VERSION pacific
RUN apt-get update && apt-get install -yq software-properties-common wget \
&& wget -q -O- 'https://download.ceph.com/keys/release.asc' | apt-key add - \
&& add-apt-repository ppa:longsleep/golang-backports \
&& apt-add-repository "deb https://download.ceph.com/debian-$CEPH_VERSION/ $(lsb_release -sc) main" \
&& rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -yq \
libcephfs-dev librbd-dev librados-dev \
&& rm -rf /var/lib/apt/lists/*
FROM base as go-builder
RUN add-apt-repository ppa:longsleep/golang-backports \
&& apt-get update \
&& apt-get install -yq \
git golang-$GO_VERSION-go
ENV GOPATH /go
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH
ENV PATH /usr/lib/go-$GO_VERSION/bin:$PATH
RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH"
COPY go.* main.go /go/src/github.com/wetopi/docker-volume-rbd/
COPY lib /go/src/github.com/wetopi/docker-volume-rbd/lib
WORKDIR /go/src/github.com/wetopi/docker-volume-rbd
RUN set -ex \
&& go mod tidy \
&& go install
FROM base
RUN apt-get update && apt-get install -yq \
ceph-common \
xfsprogs \
kmod vim \
&& mkdir -p /run/docker/plugins /mnt/state /mnt/volumes /etc/ceph \
&& rm -rf /var/lib/apt/lists/*
COPY --from=go-builder /go/bin/docker-volume-rbd .
CMD ["docker-volume-rbd"]