This repository has been archived by the owner on Dec 25, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rpm.Dockerfile
56 lines (43 loc) · 1.57 KB
/
rpm.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
52
53
54
55
56
# ============================================================
# Compile binary
# ============================================================
FROM golang:1.12 AS buildenv
RUN apt-get update && apt-get install -y unzip
ARG PROTOC_ZIP=protoc-3.7.1-linux-x86_64.zip
RUN curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v3.7.1/$PROTOC_ZIP
RUN unzip -o $PROTOC_ZIP -d /usr/local bin/protoc
RUN unzip -o $PROTOC_ZIP -d /usr/local 'include/*'
RUN rm -f $PROTOC_ZIP
RUN go get -u github.com/asdine/genji/...
RUN go get -u github.com/golang/protobuf/protoc-gen-go
RUN echo $GOPATH
RUN ls -al $GOPATH/bin
WORKDIR /go/src/github.com/Megalithic-LLC/on-prem-emaild
COPY . .
RUN make generate && make
# ============================================================
# Build an RPM package
# ============================================================
FROM centos:7
RUN yum install -y automake gcc libffi-devel make rpm-build ruby-devel rubygems
RUN gem install --no-ri --no-rdoc fpm -v '1.11.0'
COPY emaild.service /usr/lib/systemd/system/on-prem-emaild.service
RUN mkdir -p /var/on-prem/emaild
COPY --from=buildenv /go/bin/on-prem-emaild /usr/bin/
# Create RPM package
WORKDIR /
ARG VERSION=0.0.0
ARG ITERATION=0
RUN fpm \
--input-type dir \
--output-type rpm \
--name on-prem-emaild \
--description "On-Prem Email" \
--version ${VERSION} \
--iteration ${ITERATION} \
/usr/bin/on-prem-emaild \
/usr/lib/systemd/system/on-prem-emaild.service \
/var/on-prem/emaild
# Provide an easy means of copying the archive out of the image
VOLUME /output
CMD cp -v *.rpm /output