Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ deb:
$(CHOWN_TO_USER) build/

.PHONY: rpm
rpm: centos-7 fedora-28
rpm: centos-7 fedora-28 rhel-8

.PHONY: centos-7
centos-7:
Expand All @@ -80,6 +80,15 @@ centos-7:
docker run --rm $(VOLUME_MOUNTS) --env RUNC_NOKMEM=nokmem -t $(BUILDER_IMAGE)
$(CHOWN_TO_USER) build/

.PHONY: rhel-8
rhel-8:
# TODO: Add btrfs back if it's packaged in RHEL 8 GA
$(BUILD) \
-f dockerfiles/rhel.dockerfile \
-t $(BUILDER_IMAGE) .
docker run --rm $(VOLUME_MOUNTS) -t $(BUILDER_IMAGE)
$(CHOWN_TO_USER) build/

.PHONY: fedora-%
fedora-%:
$(BUILD) \
Expand Down
33 changes: 33 additions & 0 deletions dockerfiles/rhel.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
ARG BUILD_IMAGE=dockereng/rhel-8:latest
# Install golang since the package managed one probably is too old and ppa's don't cover all distros
ARG GOLANG_IMAGE
FROM ${GOLANG_IMAGE} as golang

FROM alpine:3.8 as containerd
RUN apk -u --no-cache add git
ARG REF
RUN git clone https://github.com/containerd/containerd.git /containerd
RUN git -C /containerd checkout ${REF}

FROM alpine:3.8 as runc
RUN apk -u --no-cache add git
ARG RUNC_REF
RUN git clone https://github.com/opencontainers/runc.git /runc
RUN git -C /runc checkout ${RUNC_REF}

FROM ${BUILD_IMAGE}
RUN yum install -y rpm-build yum-utils git
ENV GOPATH /go
ENV PATH $PATH:/usr/local/go/bin:$GOPATH/bin
ENV GO_SRC_PATH /go/src/github.com/containerd/containerd
ENV BUILDTAGS no_btrfs
COPY --from=golang /usr/local/go /usr/local/go/
RUN go get github.com/cpuguy83/go-md2man
COPY --from=containerd /containerd ${GO_SRC_PATH}
COPY --from=runc /runc /go/src/github.com/opencontainers/runc
COPY common/ /root/rpmbuild/SOURCES/
COPY rpm/containerd.spec /root/rpmbuild/SPECS/containerd.spec
COPY scripts/build-rpm /build-rpm
COPY scripts/.rpm-helpers /.rpm-helpers
WORKDIR /root/rpmbuild
ENTRYPOINT ["/build-rpm"]
3 changes: 3 additions & 0 deletions rpm/containerd.spec
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,14 @@ BuildRequires: gcc
BuildRequires: systemd
BuildRequires: libseccomp-devel

# Should only return true if `el8` (rhel8) is NOT defined
%if 0%{!?el8:1}
%if 0%{?suse_version}
BuildRequires: libbtrfs-devel
%else
BuildRequires: btrfs-progs-devel
%endif
%endif

%{?systemd_requires}

Expand Down
2 changes: 1 addition & 1 deletion scripts/build-rpm
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export VERSION
DIST=$( get_distribution)
if [ "$DIST" == centos ] || [ "$DIST" == clefos ]; then
(set -x; yum-builddep -y SPECS/containerd.spec; rpmbuild -ba SPECS/containerd.spec)
elif [ "$DIST" == fedora ]; then
elif [ "$DIST" == fedora ] || [ "$DIST" == rhel ]; then
(set -x; dnf builddep -y SPECS/containerd.spec; rpmbuild -ba SPECS/containerd.spec)
else
# For distributions who don't have a builddep step, not naming names...
Expand Down