-
Notifications
You must be signed in to change notification settings - Fork 33
/
Dockerfile.rpm
30 lines (27 loc) · 1.14 KB
/
Dockerfile.rpm
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
ARG build_image=84codes/crystal:latest-fedora-39
FROM $build_image AS builder
RUN dnf install -y --nodocs --setopt=install_weak_deps=False \
rpmdevtools rpmlint systemd-rpm-macros make help2man lz4-devel
RUN rpmdev-setuptree
COPY lavinmq.spec /root/rpmbuild/SPECS/
ARG version
RUN sed -i -E "s/^(Version:).*/\1 $version/" /root/rpmbuild/SPECS/lavinmq.spec
RUN rpmlint /root/rpmbuild/SPECS/lavinmq.spec
WORKDIR /usr/src/lavinmq
COPY Makefile README.md LICENSE NOTICE CHANGELOG.md shard.yml shard.lock ./
COPY extras/lavinmq.service extras/lavinmq.ini extras/
COPY static/ static/
COPY views/ views/
COPY src/ src/
RUN sed -i -E "s/(VERSION =) .*/\1 \"$version\"/" src/lavinmq/version.cr
RUN tar -czf /root/rpmbuild/SOURCES/lavinmq.tar.gz -C /usr/src lavinmq
ARG MAKEFLAGS=-j2
RUN rpmbuild -ba /root/rpmbuild/SPECS/lavinmq.spec
RUN rpmlint /root/rpmbuild/RPMS/* || true
FROM fedora:39 AS test
COPY --from=builder /root/rpmbuild/RPMS /tmp/RPMS
RUN find /tmp/RPMS -type f -exec dnf install -y {} \;
RUN lavinmq --version
# Copy the deb package to a scratch image, that then can be exported
FROM scratch
COPY --from=builder /root/rpmbuild/RPMS /root/rpmbuild/SRPMS .