refactor centos-7 Dockerfile for multi-stage
Also moved package deps into spec file BuildRequires. Had to hard-code Epoch in spec file in order to realize deps with yum-builddep. Signed-off-by: Andrew Hsu <andrewhsu@docker.com> Upstream-commit: 784a53cec5061e6a718acc3a7104c61215c15078 Component: packaging
This commit is contained in:
@@ -1,33 +1,21 @@
|
||||
FROM arm64v8/centos:7
|
||||
RUN yum groupinstall -y "Development Tools"
|
||||
RUN yum -y swap -- remove systemd-container systemd-container-libs -- install systemd systemd-libs
|
||||
RUN yum install -y \
|
||||
glibc-static \
|
||||
btrfs-progs-devel \
|
||||
device-mapper-devel \
|
||||
libseccomp-devel \
|
||||
libselinux-devel \
|
||||
libtool-ltdl-devel \
|
||||
selinux-policy-devel \
|
||||
systemd-devel \
|
||||
pkgconfig \
|
||||
tar \
|
||||
git \
|
||||
cmake \
|
||||
rpmdevtools \
|
||||
vim-common
|
||||
|
||||
FROM alpine:latest as golang
|
||||
RUN apk add curl
|
||||
ARG GO_VERSION
|
||||
RUN curl -fsSL "https://golang.org/dl/go${GO_VERSION}.linux-arm64.tar.gz" | tar xzC /usr/local
|
||||
|
||||
FROM centos:7
|
||||
ENV DISTRO centos
|
||||
ENV SUITE 7
|
||||
RUN curl -fSL "https://golang.org/dl/go${GO_VERSION}.linux-arm64.tar.gz" | tar xzC /usr/local
|
||||
RUN mkdir -p /go
|
||||
ENV GOPATH=/go
|
||||
ENV PATH $PATH:/usr/local/go/bin:/go/bin
|
||||
ENV PATH $PATH:/usr/local/go/bin:$GOPATH/bin
|
||||
ENV AUTO_GOPATH 1
|
||||
ENV DOCKER_BUILDTAGS pkcs11 seccomp selinux
|
||||
ENV RUNC_BUILDTAGS seccomp selinux
|
||||
RUN mkdir -p /go/src/github.com/docker && mkdir -p /go/src/github.com/opencontainers
|
||||
COPY docker-ce.spec /root/rpmbuild/SPECS/docker-ce.spec
|
||||
RUN yum install -y rpm-build rpmlint
|
||||
RUN rpmlint /root/rpmbuild/SPECS/docker-ce.spec # make sure spec file is ok before installing build deps
|
||||
RUN yum-builddep -y /root/rpmbuild/SPECS/docker-ce.spec # this always exits 0 so need to rpmlint before running
|
||||
RUN mkdir -p /go/src/github.com/docker /go/src/github.com/opencontainers
|
||||
COPY --from=golang /usr/local/go /usr/local/go/
|
||||
WORKDIR /root/rpmbuild
|
||||
ENTRYPOINT ["/bin/rpmbuild"]
|
||||
|
||||
@@ -1,33 +1,21 @@
|
||||
FROM centos:7
|
||||
RUN yum groupinstall -y "Development Tools"
|
||||
RUN yum -y swap -- remove systemd-container systemd-container-libs -- install systemd systemd-libs
|
||||
RUN yum install -y \
|
||||
glibc-static \
|
||||
btrfs-progs-devel \
|
||||
device-mapper-devel \
|
||||
libseccomp-devel \
|
||||
libselinux-devel \
|
||||
libtool-ltdl-devel \
|
||||
selinux-policy-devel \
|
||||
systemd-devel \
|
||||
pkgconfig \
|
||||
tar \
|
||||
git \
|
||||
cmake \
|
||||
rpmdevtools \
|
||||
vim-common
|
||||
|
||||
FROM alpine:latest as golang
|
||||
RUN apk add curl
|
||||
ARG GO_VERSION
|
||||
RUN curl -fsSL "https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz" | tar xzC /usr/local
|
||||
|
||||
FROM centos:7
|
||||
ENV DISTRO centos
|
||||
ENV SUITE 7
|
||||
RUN curl -fSL "https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz" | tar xzC /usr/local
|
||||
RUN mkdir -p /go
|
||||
ENV GOPATH=/go
|
||||
ENV PATH $PATH:/usr/local/go/bin:/go/bin
|
||||
ENV PATH $PATH:/usr/local/go/bin:$GOPATH/bin
|
||||
ENV AUTO_GOPATH 1
|
||||
ENV DOCKER_BUILDTAGS pkcs11 seccomp selinux
|
||||
ENV RUNC_BUILDTAGS seccomp selinux
|
||||
RUN mkdir -p /go/src/github.com/docker && mkdir -p /go/src/github.com/opencontainers
|
||||
COPY docker-ce.spec /root/rpmbuild/SPECS/docker-ce.spec
|
||||
RUN yum install -y rpm-build rpmlint
|
||||
RUN rpmlint /root/rpmbuild/SPECS/docker-ce.spec # make sure spec file is ok before installing build deps
|
||||
RUN yum-builddep -y /root/rpmbuild/SPECS/docker-ce.spec # this always exits 0 so need to rpmlint before running
|
||||
RUN mkdir -p /go/src/github.com/docker /go/src/github.com/opencontainers
|
||||
COPY --from=golang /usr/local/go /usr/local/go/
|
||||
WORKDIR /root/rpmbuild
|
||||
ENTRYPOINT ["/bin/rpmbuild"]
|
||||
|
||||
@@ -17,6 +17,15 @@ Packager: Docker <support@docker.com>
|
||||
%global is_systemd 1
|
||||
%global with_selinux 1
|
||||
|
||||
BuildRequires: make
|
||||
BuildRequires: cmake
|
||||
BuildRequires: gcc
|
||||
BuildRequires: git
|
||||
BuildRequires: glibc-static
|
||||
BuildRequires: libtool-ltdl-devel
|
||||
BuildRequires: libseccomp-devel
|
||||
BuildRequires: device-mapper-devel
|
||||
BuildRequires: btrfs-progs-devel
|
||||
BuildRequires: pkgconfig(systemd)
|
||||
BuildRequires: pkgconfig(libsystemd-journal)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user