forked from zeromq/zproject
-
Notifications
You must be signed in to change notification settings - Fork 0
/
zproject_docker.gsl
74 lines (63 loc) · 2.24 KB
/
zproject_docker.gsl
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
70
71
72
73
74
# Generate docker packaging for project
#
# This is a code generator built using the iMatix GSL code generation
# language. See https://github.com/zeromq/gsl for details.
#
# Copyright (c) the Contributors as noted in the AUTHORS file.
# This file is part of zproject.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
register_target ("docker", "packaging for Docker")
.macro generate_docker_file ()
.output "Dockerfile"
FROM ubuntu:latest
MAINTAINER $(project.name) Developers <$(project.email)>
RUN DEBIAN_FRONTEND=noninteractive apt-get update -y -q
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y -q --force-yes build-essential git-core libtool autotools-dev autoconf automake pkg-config unzip libkrb5-dev cmake
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y -q --force-yes \\
.for use where !optional & defined (use.debian_name) & use.draft ?<> 1
$(use.debian_name)$(last ()?? ""? " \\")
.endfor
RUN useradd -d /home/zmq -m -s /bin/bash zmq
RUN echo "zmq ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
.for use where !optional & defined (use.tarball) & !defined (use.debian_name) & use.draft ?<> 1
WORKDIR /tmp
RUN wget $(use.tarball)
RUN tar -xzf \$(basename "$(use.tarball)")
RUN rm \$(basename "$(use.tarball)")
WORKDIR /tmp/\$(basename "$(use.tarball)" .tar.gz)
RUN ./configure --quiet --without-docs
RUN make
RUN make install
RUN ldconfig
.endfor
.for use where (!optional & !defined (use.tarball) & !defined (use.debian_name)) | (!optional & use.draft = 1)
WORKDIR /tmp
RUN git clone --quiet $(use.repository) $(use.project)
WORKDIR /tmp/$(use.project)
RUN ./autogen.sh 2> /dev/null
RUN ./configure --quiet --without-docs
RUN make
RUN make install
RUN ldconfig
.endfor
WORKDIR /tmp
RUN git clone --quiet $(project.repository) $(project.name:c)
WORKDIR /tmp/$(project.name:c)
RUN ./autogen.sh 2> /dev/null
RUN ./configure --quiet --without-docs
RUN make
RUN make install
RUN ldconfig
.if file.exists ("Dockerfile.in")
$(file.slurp ("Dockerfile.in"))
.endif
USER zmq
.endmacro
function target_docker
if defined (project.repository)
generate_docker_file ()
endif
endfunction