-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild-deb-Dockerfile
36 lines (32 loc) · 2.04 KB
/
build-deb-Dockerfile
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
FROM ubuntu:21.04
ARG mementoembed_version
ARG DEBIAN_FRONTEND=noninteractive
# dpkg build dependencies
RUN apt-get update -y
RUN apt-get install -y python3 python3-virtualenv nodejs sed grep tar python-is-python3 npm
# build the dpkg - directions from https://www.internalpointers.com/post/build-binary-deb-package-practical-guide
WORKDIR /buildapp
RUN mkdir mementoembed_amd64
RUN mkdir -p mementoembed_amd64/opt/mementoembed
RUN mkdir -p mementoembed_amd64/etc/systemd/system
RUN mkdir -p debbuild
COPY installer/generic-unix/install-mementoembed.sh .
RUN ./install-mementoembed.sh -- --install-directory /buildapp/mementoembed_amd64/opt/mementoembed --python-exe /usr/bin/python
RUN mv /etc/mementoembed.cfg /buildapp/mementoembed_amd64/etc/
RUN mv /etc/systemd/system/mementoembed.service /buildapp/mementoembed_amd64/etc/systemd/system/
RUN sed -i "s?/buildapp/mementoembed_amd64??g" /buildapp/mementoembed_amd64/etc/mementoembed.cfg
RUN sed -i "s?/buildapp/mementoembed_amd64??g" /buildapp/mementoembed_amd64/etc/systemd/system/mementoembed.service
RUN find /buildapp/mementoembed_amd64/opt/mementoembed/mementoembed-virtualenv/bin -type f -exec sed -i "s?/buildapp/mementoembed_amd64??g" {} \;
RUN find /buildapp/mementoembed_amd64/opt/mementoembed/node_modules -type f -exec sed -i "s?/buildapp/mementoembed_amd64??g" {} \;
RUN mkdir mementoembed_amd64/DEBIAN
COPY mementoembed.control .
COPY mementoembed.preinst mementoembed_amd64/DEBIAN/preinst
RUN chmod 0755 mementoembed_amd64/DEBIAN/preinst
COPY mementoembed.postinst mementoembed_amd64/DEBIAN/postinst
RUN chmod 0755 mementoembed_amd64/DEBIAN/postinst
COPY mementoembed.postun mementoembed_amd64/DEBIAN/postrm
RUN chmod 0755 mementoembed_amd64/DEBIAN/postrm
RUN sed "s?{{ mementoembed_version }}?${mementoembed_version}?g" /buildapp/mementoembed.control > mementoembed_amd64/DEBIAN/control
RUN printf "#!/bin/bash\ndpkg-deb --root-owner-group --build mementoembed_amd64 debbuild/MementoEmbed-${mementoembed_version}.deb" > /buildapp/build-deb.sh
RUN chmod 0700 /buildapp/build-deb.sh
CMD ["/buildapp/build-deb.sh"]