forked from xenserver/xenserver-build-env
-
Notifications
You must be signed in to change notification settings - Fork 19
/
Dockerfile-7.x
69 lines (57 loc) · 2.17 KB
/
Dockerfile-7.x
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
57
58
59
60
61
62
63
64
65
66
67
68
69
FROM centos:7.2.1511
ARG CUSTOM_BUILDER_UID=""
ARG CUSTOM_BUILDER_GID=""
# Remove all repositories
RUN rm /etc/yum.repos.d/*
# Add only the specific CentOS 7.2 repositories, because that's what XS used for the majority of packages
COPY files/tmp-CentOS-Vault.repo /etc/yum.repos.d/CentOS-Vault-7.2.repo
# Add our repositories
# Repository file depends on the target version of XCP-ng, and is pre-processed by build.sh
COPY files/tmp-xcp-ng.repo /etc/yum.repos.d/xcp-ng.repo
# Fix invalid rpmdb checksum error with overlayfs, see https://github.com/docker/docker/issues/10180
RUN yum install -y yum-plugin-ovl
# Use priorities so that packages from our repositories are preferred over those from CentOS repositories
RUN yum install -y yum-plugin-priorities
# Update
RUN yum update -y
# Build requirements
RUN yum install -y --exclude=gcc-xs \
gcc \
gcc-c++ \
git \
git-lfs \
make \
mercurial \
mock \
rpm-build \
rpm-python \
sudo \
yum-utils \
epel-release
# Niceties
RUN yum install -y \
vim \
wget \
which
# OCaml in XS is slightly older than in CentOS
RUN sed -i "/gpgkey/a exclude=ocaml*" /etc/yum.repos.d/Cent* /etc/yum.repos.d/epel*
# Set up the builder user
RUN bash -c ' \
OPTS=(); \
if [ -n "${CUSTOM_BUILDER_UID}" ]; then \
OPTS+=("-u" "${CUSTOM_BUILDER_UID}"); \
fi; \
if [ -n "${CUSTOM_BUILDER_GID}" ]; then \
OPTS+=("-g" "${CUSTOM_BUILDER_GID}"); \
if ! getent group "${CUSTOM_BUILDER_GID}" >/dev/null; then \
groupadd -g "${CUSTOM_BUILDER_GID}" builder; \
fi; \
fi; \
useradd "${OPTS[@]}" builder; \
' \
&& echo "builder:builder" | chpasswd \
&& echo "builder ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers \
&& usermod -G mock builder
RUN mkdir -p /usr/local/bin
COPY files/init-container.sh /usr/local/bin/init-container.sh
COPY files/rpmmacros /home/builder/.rpmmacros