-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.template
114 lines (87 loc) · 3.71 KB
/
Dockerfile.template
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# Base image
FROM resin/%%RESIN_MACHINE_NAME%%-python:2.7
MAINTAINER Benoit Guigal <[email protected]>
ENV DEVICE_TYPE=%%RESIN_MACHINE_NAME%%
ENV INITSYSTEM on
RUN mkdir -p /usr/src/app/
WORKDIR /usr/src/app/
# update new sources because docker image is outdates, see https://superuser.com/a/1423685
RUN printf "deb http://archive.debian.org/debian/ jessie main\ndeb-src http://archive.debian.org/debian/ jessie main\ndeb http://security.debian.org jessie/updates main\ndeb-src http://security.debian.org jessie/updates main" > /etc/apt/sources.list
RUN apt-get update && apt-get install -yq \
libjpeg-dev \
libgif-dev \
cups \
libcups2-dev \
cups-filters \
libgutenprint2 \
printer-driver-gutenprint \
avahi-daemon \
avahi-utils \
libnss-mdns \
libdbus-1-dev \
imagemagick \
mlocate \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& systemctl enable avahi-daemon
# -- Start PhantomJS section -- #
RUN set -x \
# Install official PhantomJS release
&& mkdir /tmp/phantomjs \
&& curl -L https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2 \
| tar -xj --strip-components=1 -C /tmp/phantomjs \
&& mv /tmp/phantomjs/bin/phantomjs /usr/local/bin \
# Install dumb-init (to handle PID 1 correctly).
# https://github.com/Yelp/dumb-init
&& curl -Lo /tmp/dumb-init.deb https://github.com/Yelp/dumb-init/releases/download/v1.1.3/dumb-init_1.1.3_amd64.deb \
&& dpkg -i /tmp/dumb-init.deb
RUN mkdir -p /usr/share/fonts/truetype
RUN rm -r /usr/share/fonts/truetype/*
ADD fonts/MaisonMono-Light.ttf /usr/share/fonts/truetype/MaisonMono-Light.ttf
RUN updatedb && \
wget http://www.imagemagick.org/Usage/scripts/imagick_type_gen && \
perl imagick_type_gen > type.xml && \
cp type.xml /etc/ImageMagick-6/type.xml && \
fc-cache -f -v && fc-list
ADD ./policy.xml /etc/ImageMagick-6/policy.xml
# -- End of PhantomJS section -- #
# -- Start of resin-wifi-connect section -- #
# Install node
ENV NODE_VERSION 6.9.1
RUN curl -SLO "http://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.gz" \
&& echo "a9d9e6308931fa2a2b0cada070516d45b76d752430c31c9198933c78f8d54b17 node-v$NODE_VERSION-linux-x64.tar.gz" | sha256sum -c - \
&& tar -xzf "node-v$NODE_VERSION-linux-x64.tar.gz" -C /usr/local --strip-components=1 \
&& rm "node-v$NODE_VERSION-linux-x64.tar.gz" \
&& npm config set unsafe-perm true -g --unsafe-perm \
&& rm -rf /tmp/*
# Set the device type environment variable using Dockerfile templates
ENV DEVICE_TYPE=%%RESIN_MACHINE_NAME%%
RUN apt-get update && apt-get install -yq --no-install-recommends \
dnsmasq \
hostapd \
iproute2 \
iw \
libexpat-dev \
rfkill \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
ENV RESIN_WIFI_CONNECT_VERSION 2.0.9
RUN curl -SL "https://github.com/Postcard/resin-wifi-connect/archive/v$RESIN_WIFI_CONNECT_VERSION.tar.gz" \
| tar xzC /usr/src/app/ \
&& mv resin-wifi-connect-$RESIN_WIFI_CONNECT_VERSION resin-wifi-connect \
&& cd resin-wifi-connect \
&& JOBS=MAX npm install --unsafe-perm --production \
&& npm cache clean \
&& ./node_modules/.bin/bower --allow-root install \
&& ./node_modules/.bin/bower --allow-root cache clean \
&& ./node_modules/.bin/coffee -c ./src
# -- End of resin-wifi-connect section -- #
# create an admin user for cups
RUN useradd -ms /bin/bash cups_admin && echo 'cups_admin:cups' | chpasswd && usermod -a -G lpadmin cups_admin
COPY ./cupsd.conf /etc/cups/
COPY ./Xerox_Phaser_7100N.ppd /usr/share/ppd/
COPY requirements.txt ./
RUN pip install -r requirements.txt
COPY xerox_phaser_cups /usr/src/app/xerox_phaser_cups
COPY start.sh ./
RUN chmod +x start.sh
CMD ["/bin/bash", "start.sh"]