-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile.release-el7
31 lines (22 loc) · 1.49 KB
/
Dockerfile.release-el7
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
FROM centos:7
ARG PACKAGE_VERSION
RUN if [ -z "${PACKAGE_VERSION}" ]; then echo "--build-arg PACKAGE_VERSION is required"; exit 1; fi
ENV RUST_ARCHIVE=rust-1.71.0-x86_64-unknown-linux-gnu.tar.gz
ENV RUST_DOWNLOAD_URL=https://static.rust-lang.org/dist/$RUST_ARCHIVE
RUN yum --quiet -y update && yum --quiet -y install git gcc curl openssl openssl-devel ca-certificates tar gcc make rpm-build libffi-devel && yum clean all --quiet
RUN yum install --quiet -y centos-release-scl && yum install --quiet -y rh-ruby23 rh-ruby23-rubygems rh-ruby23-ruby-devel && yum clean all --quiet
RUN scl enable rh-ruby23 'gem install --no-ri --no-rdoc json && gem install --no-ri --no-rdoc fpm && gem clean'
WORKDIR /rust
RUN curl -fsOSL $RUST_DOWNLOAD_URL \
&& curl -s $RUST_DOWNLOAD_URL.sha256 | sha256sum -c - \
&& tar -C /rust -xzf $RUST_ARCHIVE --strip-components=1 \
&& rm $RUST_ARCHIVE \
&& ./install.sh --without=rust-docs
WORKDIR /mountstatus
COPY Cargo.toml /mountstatus/
COPY src/ /mountstatus/src/
COPY packaging/systemd/ /mountstatus/systemd/
COPY packaging/sysconfig /mountstatus/
RUN cargo build --release && strip target/release/mount_status_monitor
RUN scl enable rh-ruby23 "fpm -s dir -t rpm --rpm-dist el7 -n mount-status-monitor --version ${PACKAGE_VERSION} --replaces MountStatusMonitor target/release/mount_status_monitor=/usr/sbin/mount_status_monitor systemd/mount_status_monitor.service=/etc/systemd/system/mount_status_monitor.service"
CMD /bin/cp -vr /mountstatus/*.rpm /host-packages-volume