-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile.compile.build
709 lines (616 loc) · 30 KB
/
Dockerfile.compile.build
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
FROM bossjones/boss-docker-python3:latest
MAINTAINER Malcolm Jones <[email protected]>
# Prepare packaging environment
ENV DEBIAN_FRONTEND noninteractive
ENV TERM "xterm-256color"
# build-arg are acceptable
# eg. docker build --build-arg var=xxx
ARG SCARLETT_ENABLE_SSHD
ARG SCARLETT_ENABLE_DBUS
ARG SCARLETT_BUILD_GNOME
ARG TRAVIS_CI
# metadata
ARG CONTAINER_VERSION
ARG GIT_BRANCH
ARG GIT_SHA
ENV SCARLETT_ENABLE_SSHD ${SCARLETT_ENABLE_SSHD:-0}
ENV SCARLETT_ENABLE_DBUS ${SCARLETT_ENABLE_DBUS:-'true'}
ENV SCARLETT_BUILD_GNOME ${SCARLETT_BUILD_GNOME:-'true'}
ENV TRAVIS_CI ${TRAVIS_CI:-'true'}
RUN echo "SCARLETT_ENABLE_SSHD: ${SCARLETT_ENABLE_SSHD}"
RUN echo "SCARLETT_ENABLE_DBUS: ${SCARLETT_ENABLE_DBUS}"
RUN echo "SCARLETT_BUILD_GNOME: ${SCARLETT_BUILD_GNOME}"
RUN echo "TRAVIS_CI: ${TRAVIS_CI}"
# # include some metadata
# ENV CONTAINER_VERSION=$CONTAINER_VERSION \
# GIT_BRANCH=$GIT_BRANCH \
# GIT_SHA=$GIT_SHA
# RUN mkdir /image-metadata && \
# cd /image-metadata && \
# echo "$CONTAINER_VERSION" > version; \
# echo "$GIT_BRANCH" > git-branch; \
# echo "$GIT_SHA" > git-sha
# make apt use ipv4 instead of ipv6 ( faster resolution )
RUN sed -i "s@^#precedence ::ffff:0:0/96 100@precedence ::ffff:0:0/96 100@" /etc/gai.conf
# Install language pack before setting env vars to utf-8
RUN \
apt-get update && \
apt-get -y upgrade && \
apt-get install -y \
language-pack-en-base && \
apt-get clean && \
apt-get autoclean -y && \
apt-get autoremove -y && \
rm -rf /var/lib/{cache,log}/ && \
rm -rf /var/lib/apt/lists/*.lz4 /tmp/* /var/tmp/*
# # Ensure UTF-8 lang and locale
RUN locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LC_ALL en_US.UTF-8
# ensure local python is preferred over distribution python
ENV PATH /usr/local/bin:/usr/local/sbin:$PATH
# lets install apt-fast
RUN set -x \
apt-get update && \
apt-get install -y software-properties-common && \
add-apt-repository -y ppa:saiarcot895/myppa && \
apt-get update && \
echo "apt-fast apt-fast/maxdownloads string 5" | debconf-set-selections; \
echo "apt-fast apt-fast/dlflag boolean true" | debconf-set-selections; \
echo "apt-fast apt-fast/aptmanager string apt-get" | debconf-set-selections; \
DEBIAN_FRONTEND=noninteractive apt-get install -y apt-fast && \
apt-fast update && \
# now that apt-fast is setup, lets clean everything in this layer
apt-fast autoremove -y && \
# now clean regular apt-get stuff
apt-get clean && \
apt-get autoclean -y && \
apt-get autoremove -y && \
rm -rf /var/lib/{cache,log}/ && \
rm -rf /var/lib/apt/lists/*.lz4 /tmp/* /var/tmp/*
# this is what we need to sed
# _DOWNLOADER='aria2c -c -j ${_MAXNUM} -x ${_MAXNUM} -s ${_MAXNUM} --min-split-size=1M -i ${DLLIST} --connect-timeout=600 --timeout=600 -m0'
# http://bugs.python.org/issue19846
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
# FIXME: DO NOT SET env var USER
ENV UNAME "pi"
ENV NOT_ROOT_USER "pi"
# /home/pi
ENV USER_HOME "/home/${UNAME}"
# /home/pi/dev
ENV PROJECT_HOME "/home/${UNAME}/dev"
ENV LANG C.UTF-8
ENV SKIP_ON_TRAVIS yes
ENV CURRENT_DIR $(pwd)
ENV GSTREAMER 1.0
ENV ENABLE_PYTHON3 yes
ENV ENABLE_GTK yes
ENV PYTHON_VERSION_MAJOR 3
ENV PYTHON_VERSION 3.5
ENV CFLAGS "-fPIC -O0 -ggdb -fno-inline -fno-omit-frame-pointer"
ENV MAKEFLAGS "-j4 V=1"
# /home/pi/jhbuild
ENV PREFIX "${USER_HOME}/jhbuild"
# /home/pi/gnome
ENV JHBUILD "${USER_HOME}/gnome"
# /home/pi/.virtualenvs
ENV PATH_TO_DOT_VIRTUALENV "${USER_HOME}/.virtualenvs"
# /home/pi/jhbuild/bin:/home/pi/jhbuild/sbin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
ENV PATH ${PREFIX}/bin:${PREFIX}/sbin:${PATH}
# /home/pi/.virtualenvs/scarlett_os/lib
ENV LD_LIBRARY_PATH ${PREFIX}/lib:${LD_LIBRARY_PATH}
# /home/pi/jhbuild/lib/python3.5/site-packages:/usr/lib/python3.5/site-packages
ENV PYTHONPATH ${PREFIX}/lib/python${PYTHON_VERSION}/site-packages:/usr/lib/python${PYTHON_VERSION}/site-packages
# /home/pi/.virtualenvs/scarlett_os/lib/pkgconfig
ENV PKG_CONFIG_PATH ${PREFIX}/lib/pkgconfig:${PREFIX}/share/pkgconfig:/usr/lib/pkgconfig
# /home/pi/jhbuild/share:/usr/share
ENV XDG_DATA_DIRS ${PREFIX}/share:/usr/share
# /home/pi/jhbuild/etc/xdg
ENV XDG_CONFIG_DIRS ${PREFIX}/etc/xdg
ENV PYTHON "python3"
ENV TERM "xterm-256color"
ENV PACKAGES "python3-gi python3-gi-cairo"
ENV CC gcc
RUN ln -fs /usr/share/zoneinfo/UTC /etc/localtime && \
dpkg-reconfigure -f noninteractive tzdata && \
sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
echo 'LANG="en_US.UTF-8"' > /etc/default/locale && \
dpkg-reconfigure -f noninteractive locales && \
update-locale LANG=en_US.UTF-8 && \
echo 'deb http://us.archive.ubuntu.com/ubuntu/ xenial main restricted' | tee /etc/apt/sources.list && \
echo 'deb-src http://us.archive.ubuntu.com/ubuntu/ xenial main restricted' | tee -a /etc/apt/sources.list && \
echo 'deb http://us.archive.ubuntu.com/ubuntu/ xenial-updates main restricted' | tee -a /etc/apt/sources.list && \
echo 'deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-updates main restricted' | tee -a /etc/apt/sources.list && \
echo 'deb http://us.archive.ubuntu.com/ubuntu/ xenial universe' | tee -a /etc/apt/sources.list && \
echo 'deb-src http://us.archive.ubuntu.com/ubuntu/ xenial universe' | tee -a /etc/apt/sources.list && \
echo 'deb http://us.archive.ubuntu.com/ubuntu/ xenial-updates universe' | tee -a /etc/apt/sources.list && \
echo 'deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-updates universe' | tee -a /etc/apt/sources.list && \
echo 'deb http://us.archive.ubuntu.com/ubuntu/ xenial-security main restricted' | tee -a /etc/apt/sources.list && \
echo 'deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-security main restricted' | tee -a /etc/apt/sources.list && \
echo 'deb http://us.archive.ubuntu.com/ubuntu/ xenial-security universe' | tee -a /etc/apt/sources.list && \
echo 'deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-security universe' | tee -a /etc/apt/sources.list && \
echo 'deb http://us.archive.ubuntu.com/ubuntu/ xenial multiverse' | tee -a /etc/apt/sources.list && \
echo 'deb http://us.archive.ubuntu.com/ubuntu/ xenial-updates multiverse' | tee -a /etc/apt/sources.list && \
echo 'deb http://security.ubuntu.com/ubuntu xenial-security main restricted' | tee -a /etc/apt/sources.list && \
echo 'deb http://security.ubuntu.com/ubuntu xenial-security main restricted' | tee -a /etc/apt/sources.list && \
echo 'deb http://security.ubuntu.com/ubuntu xenial-security universe' | tee -a /etc/apt/sources.list && \
echo 'deb http://us.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse' | tee -a /etc/apt/sources.list && \
echo 'deb http://security.ubuntu.com/ubuntu xenial-security multiverse' | tee -a /etc/apt/sources.list && \
cat /etc/apt/sources.list | grep -v "^#" | sort -u > /etc/apt/sources.list.bak && \
mv -fv /etc/apt/sources.list.bak /etc/apt/sources.list && \
add-apt-repository -y ppa:ricotz/testing && \
add-apt-repository -y ppa:gnome3-team/gnome3 && \
add-apt-repository -y ppa:gnome3-team/gnome3-staging && \
add-apt-repository -y ppa:pitti/systemd-semaphore && \
apt-fast update -yqq && \
apt-fast upgrade -yqq && \
export LANG=en_US.UTF-8 && \
apt-fast install -qqy libpulse-dev espeak && \
apt-cache search --names-only '^(lib)?gstreamer1.0\S*' | sed 's/\(.*\) -.*/\1 /' | grep -iv "Speech" > dependencies && \
cat dependencies && \
apt-fast build-dep -y `cat dependencies` && \
apt-fast install -qqy gnome-common \
gtk-doc-tools \
libgtk-3-dev \
libgirepository1.0-dev \
yelp-tools \
libgladeui-dev \
python3-dev \
python3-cairo-dev \
python3-gi \
automake \
autopoint \
bison \
build-essential \
byacc \
flex \
gcc \
automake \
autoconf \
libtool \
bison \
swig \
python-dev \
libpulse-dev \
gettext \
gnome-common \
gtk-doc-tools \
libgtk-3-dev \
libgirepository1.0-dev \
python3-gi-cairo \
yasm \
nasm \
bison \
flex \
libusb-1.0-0-dev \
libgudev-1.0-dev \
libxv-dev \
build-essential \
autotools-dev \
automake \
autoconf \
libtool \
binutils \
autopoint \
libxml2-dev \
zlib1g-dev \
libglib2.0-dev \
pkg-config \
flex \
python \
libasound2-dev \
libgudev-1.0-dev \
libxt-dev \
libvorbis-dev \
libcdparanoia-dev \
libpango1.0-dev \
libtheora-dev \
libvisual-0.4-dev \
iso-codes \
libgtk-3-dev \
libraw1394-dev \
libiec61883-dev \
libavc1394-dev \
libv4l-dev \
libcairo2-dev \
libcaca-dev \
libspeex-dev \
libpng-dev \
libshout3-dev \
libjpeg-dev \
libaa1-dev \
libflac-dev \
libdv4-dev \
libtag1-dev \
libwavpack-dev \
libpulse-dev \
gstreamer1.0* \
lame \
flac \
libfftw3-dev \
xvfb \
gir1.2-gtk-3.0 \
xsltproc \
docbook-xml \
docbook-xsl \
python-libxml2 \
sudo \
# begin - gst-plugins-bad req
libqt4-opengl \
libdvdread4 \
libdvdnav4 \
libllvm3.8 \
libsoundtouch-dev \
libsoundtouch1 \
# For general debugging
gdb \
strace \
lsof \
ltrace \
yelp-xsl \
docbook-xsl \
docbook-xsl-doc-html \
python-libxslt1 \
libxslt1-dev \
graphviz \
openssh-server \
# optimize compiling
gperf \
bc \
ccache \
file \
rsync \
# vim for debugging
# vim for debugging
vim \
source-highlight \
fortune \
# end gst-plugins-bad req
ubuntu-restricted-extras && \
apt-fast update && \
# now that apt-fast is setup, lets clean everything in this layer
apt-fast autoremove -y && \
# now clean regular apt-get stuff
apt-get clean && \
apt-get autoclean -y && \
apt-get autoremove -y && \
rm -rf /var/lib/{cache,log}/ && \
rm -rf /var/lib/apt/lists/*.lz4 /tmp/* /var/tmp/*
##########################################################
# needed to fix *.html issues
##########################################################
RUN apt-fast update -y && \
export LANG=en_US.UTF-8 && \
apt-fast install -y asciidoctor \
libghc-cmark-prof \
libghc-markdown-prof \
libhtml-wikiconverter-markdown-perl \
libmarkdown2-dev \
libpod-markdown-perl \
libsmdev-dev \
libsoldout1-dev \
libtext-markdown-discount-perl \
libxft2-dbg \
linuxdoc-tools \
linuxdoc-tools-info \
linuxdoc-tools-latex \
linuxdoc-tools-text \
markdown \
python-html2text \
python-markdown \
python-mistune \
python3-html2text \
python3-markdown \
python3-misaka \
# specifics gtk-doc
docbook-utils \
docbook-xsl \
docbook-simple \
docbook-to-man \
docbook-dsssl \
jade \
python3-mistune && \
apt-fast update && \
# now that apt-fast is setup, lets clean everything in this layer
apt-fast autoremove -y && \
# now clean regular apt-get stuff
apt-get clean && \
apt-get autoclean -y && \
apt-get autoremove -y && \
rm -rf /var/lib/{cache,log}/ && \
rm -rf /var/lib/apt/lists/*.lz4 /tmp/* /var/tmp/*
# source: https://docs.docker.com/engine/examples/running_ssh_service/
# SSH login fix. Otherwise user is kicked off after login
RUN sed -i 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' /etc/pam.d/sshd \
&& sed -i -r 's/.?UseDNS\syes/UseDNS no/' /etc/ssh/sshd_config \
&& sed -i -r 's/.?PasswordAuthentication.+/PasswordAuthentication no/' /etc/ssh/sshd_config \
&& sed -i -r 's/.?ChallengeResponseAuthentication.+/ChallengeResponseAuthentication no/' /etc/ssh/sshd_config
# NOTE: It's an example of how to pass environment variables when running a Dockerized SSHD service.
# NOTE: SSHD scrubs the environment, therefore ENV variables contained in Dockerfile must be pushed to
# /etc/profile in order for them to be available.
# source: https://stackoverflow.com/questions/36292317/why-set-visible-now-in-etc-profile
ENV NOTVISIBLE "in users profile"
RUN echo 'export VISIBLE=now' >> /etc/profile
# virtualenv stuff
ENV VIRTUALENVWRAPPER_PYTHON '/usr/local/bin/python3'
ENV VIRTUALENVWRAPPER_VIRTUALENV '/usr/local/bin/virtualenv'
ENV VIRTUALENV_WRAPPER_SH '/usr/local/bin/virtualenvwrapper.sh'
# Ensure that Python outputs everything that's printed inside
# the application rather than buffering it.
ENV PYTHONUNBUFFERED 1
ENV PYTHON_VERSION_MAJOR "3"
ENV GSTREAMER "1.0"
ENV USER "pi"
ENV USER_HOME "/home/${UNAME}"
ENV LANGUAGE_ID 1473
ENV GITHUB_BRANCH "master"
ENV GITHUB_REPO_NAME "scarlett_os"
ENV GITHUB_REPO_ORG "bossjones"
ENV PI_HOME "/home/pi"
# /home/pi/dev/bossjones-github/scarlett_os
ENV MAIN_DIR "${PI_HOME}/dev/${GITHUB_REPO_ORG}-github/${GITHUB_REPO_NAME}"
# /home/pi/.virtualenvs/scarlett_os
ENV VIRT_ROOT "${PI_HOME}/.virtualenvs/${GITHUB_REPO_NAME}"
# /home/pi/.virtualenvs/scarlett_os/lib/pkgconfig
ENV PKG_CONFIG_PATH "${PI_HOME}/.virtualenvs/${GITHUB_REPO_NAME}/lib/pkgconfig"
# /home/pi/dev/bossjones-github/scarlett_os/tests/fixtures/.scarlett
ENV SCARLETT_CONFIG "${PI_HOME}/dev/${GITHUB_REPO_ORG}-github/${GITHUB_REPO_NAME}/tests/fixtures/.scarlett"
# /home/pi/dev/bossjones-github/scarlett_os/static/speech/hmm/en_US/hub4wsj_sc_8k
ENV SCARLETT_HMM "${PI_HOME}/dev/${GITHUB_REPO_ORG}-github/${GITHUB_REPO_NAME}/static/speech/hmm/en_US/hub4wsj_sc_8k"
# /home/pi/dev/bossjones-github/scarlett_os/static/speech/lm/1473.lm
ENV SCARLETT_LM "${PI_HOME}/dev/${GITHUB_REPO_ORG}-github/${GITHUB_REPO_NAME}/static/speech/lm/${LANGUAGE_ID}.lm"
# /home/pi/dev/bossjones-github/scarlett_os/static/speech/dict/1473.dic
ENV SCARLETT_DICT "${PI_HOME}/dev/${GITHUB_REPO_ORG}-github/${GITHUB_REPO_NAME}/static/speech/dict/${LANGUAGE_ID}.dic"
# /home/pi/.virtualenvs/repoduce_pytest_mock_issue_84/lib
ENV LD_LIBRARY_PATH "${PI_HOME}/.virtualenvs/${GITHUB_REPO_NAME}/lib"
# /home/pi/.virtualenvs/scarlett_os/lib/gstreamer-1.0
ENV GST_PLUGIN_PATH "${PI_HOME}/.virtualenvs/${GITHUB_REPO_NAME}/lib/gstreamer-${GSTREAMER}"
ENV PYTHON "/usr/local/bin/python3"
ENV PYTHON_VERSION "3.5"
ENV VIRTUALENVWRAPPER_PYTHON "/usr/local/bin/python3"
ENV VIRTUALENVWRAPPER_VIRTUALENV "/usr/local/bin/virtualenv"
ENV VIRTUALENVWRAPPER_SCRIPT "/usr/local/bin/virtualenvwrapper.sh"
# /home/pi/.pythonrc
ENV PYTHONSTARTUP "${USER_HOME}/.pythonrc"
ENV PIP_DOWNLOAD_CACHE "${USER_HOME}/.pip/cache"
# /home/pi/.virtualenvs/scarlett_os
ENV WORKON_HOME "${VIRT_ROOT}"
# Vagrant pub key for development
ENV USER_SSH_PUBKEY "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key"
# Configure runtime directory
# https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
# source: https://github.com/jakelee8/dockerfiles/blob/b1f7fd4520ae3e1b7e9ccebf2b07381a4069cc00/images/steam/steam-ubuntu16.10/Dockerfile
ENV XDG_RUNTIME_DIR=/run/user/1000
# Source: https://github.com/ambakshi/dockerfiles/blob/09a05ceab3b5a93c974783ad27a8a6301f3c4ca2/devbox/debian8/Dockerfile
RUN echo "[ \$UID -eq 0 ] && PS1='\[\e[31m\]\h:\w#\[\e[m\] ' || PS1='[\[\033[32m\]\u@\h\[\033[00m\] \[\033[36m\]\W\[\033[31m\]\$(__git_ps1)\[\033[00m\]] \$ '" | tee /etc/bash_completion.d/prompt
RUN set -xe \
&& useradd -U -d ${PI_HOME} -m -r -G adm,sudo,dip,plugdev,tty,audio ${UNAME} \
&& usermod -a -G ${UNAME} -s /bin/bash -u 1000 ${UNAME} \
&& groupmod -g 1000 ${UNAME} \
&& mkdir -p ${PI_HOME}/dev/${GITHUB_REPO_ORG}-github \
&& mkdir -p ${PI_HOME}/dev/${GITHUB_REPO_ORG}-github/${GITHUB_REPO_NAME} \
&& mkdir -p ${MAIN_DIR} \
&& ( mkdir ${PI_HOME}/.ssh \
&& chmod og-rwx ${PI_HOME}/.ssh \
&& echo "${USER_SSH_PUBKEY}" \
> ${PI_HOME}/.ssh/authorized_keys \
) \
&& chown -hR ${UNAME}:${UNAME} ${MAIN_DIR} \
&& echo 'pi ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers \
&& echo '%pi ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers \
&& cat /etc/sudoers \
&& echo 'pi:raspberry' | chpasswd \
&& mkdir -p "$XDG_RUNTIME_DIR" \
&& chown -R pi:pi "$XDG_RUNTIME_DIR" \
&& chmod -R 0700 "$XDG_RUNTIME_DIR"
# FIXME: Note this line here breaks permissions due to umask 077 running as root instead of pi user
# FIXME: removing for now, 7/20/2017
# && ( \
# umask 077 \
# && mkdir ${PI_HOME}/.ssh \
# && echo "${USER_SSH_PUBKEY}" \
# > ${PI_HOME}/.ssh/authorized_keys \
# ) \
# Prepare git to use ssh-agent, ssh keys for adobe-platform; ignore interactive knownhosts questions from ssh
# - For automated building with private repos only accessible by ssh
#
# ********************* ROOT ***********************************************
RUN mkdir -p /root/.ssh && chmod og-rwx /root/.ssh && \
echo "Host * " > /root/.ssh/config && \
echo "StrictHostKeyChecking no " >> /root/.ssh/config && \
echo "UserKnownHostsFile=/dev/null" >> /root/.ssh/config
# Prepare git to use ssh-agent, ssh keys for adobe-platform; ignore interactive knownhosts questions from ssh
# - For automated building with private repos only accessible by ssh
#
# ********************* PI USER ********************************************
RUN echo "Host * " > ${PI_HOME}/.ssh/config && \
echo "StrictHostKeyChecking no " >> ${PI_HOME}/.ssh/config && \
echo "UserKnownHostsFile=/dev/null" >> ${PI_HOME}/.ssh/config
WORKDIR /home/$UNAME
ENV HOME "/home/$UNAME"
# ENV DISPLAY :1
# Create a basic .jhbuildrc
RUN echo "import os" > /home/pi/.jhbuildrc && \
echo "prefix='$PREFIX'" >> /home/pi/.jhbuildrc && \
echo "checkoutroot='$JHBUILD'" >> /home/pi/.jhbuildrc && \
echo "moduleset = 'gnome-world'" >> /home/pi/.jhbuildrc && \
echo "interact = False" >> /home/pi/.jhbuildrc && \
echo "makeargs = '$MAKEFLAGS'" >> /home/pi/.jhbuildrc && \
echo "module_autogenargs['gtk-doc'] = 'PYTHON=/usr/bin/python3'" >> /home/pi/.jhbuildrc && \
echo "os.environ['CFLAGS'] = '$CFLAGS'" >> /home/pi/.jhbuildrc && \
echo "os.environ['PYTHON'] = 'python$PYTHON_VERSION_MAJOR'" >> /home/pi/.jhbuildrc && \
echo "os.environ['GSTREAMER'] = '1.0'" >> /home/pi/.jhbuildrc && \
echo "os.environ['ENABLE_PYTHON3'] = 'yes'" >> /home/pi/.jhbuildrc && \
echo "os.environ['ENABLE_GTK'] = 'yes'" >> /home/pi/.jhbuildrc && \
echo "os.environ['PYTHON_VERSION'] = '$PYTHON_VERSION'" >> /home/pi/.jhbuildrc && \
echo "os.environ['CFLAGS'] = '-fPIC -O0 -ggdb -fno-inline -fno-omit-frame-pointer'" >> /home/pi/.jhbuildrc && \
echo "os.environ['MAKEFLAGS'] = '-j4 V=1'" >> /home/pi/.jhbuildrc && \
echo "os.environ['PREFIX'] = '$USER_HOME/jhbuild'" >> /home/pi/.jhbuildrc && \
echo "os.environ['JHBUILD'] = '$USER_HOME/gnome'" >> /home/pi/.jhbuildrc && \
echo "os.environ['PATH'] = '$PREFIX/bin:$PREFIX/sbin:$PATH'" >> /home/pi/.jhbuildrc && \
echo "os.environ['LD_LIBRARY_PATH'] = '$PREFIX/lib:$LD_LIBRARY_PATH'" >> /home/pi/.jhbuildrc && \
echo "os.environ['PYTHONPATH'] = '$PREFIX/lib/python$PYTHON_VERSION/site-packages:/usr/lib/python$PYTHON_VERSION/site-packages'" >> /home/pi/.jhbuildrc && \
echo "os.environ['PKG_CONFIG_PATH'] = '$PREFIX/lib/pkgconfig:$PREFIX/share/pkgconfig:/usr/lib/pkgconfig'" >> /home/pi/.jhbuildrc && \
echo "os.environ['XDG_DATA_DIRS'] = '$PREFIX/share:/usr/share'" >> /home/pi/.jhbuildrc && \
echo "os.environ['XDG_CONFIG_DIRS'] = '$PREFIX/etc/xdg'" >> /home/pi/.jhbuildrc && \
echo "os.environ['CC'] = 'gcc'" >> /home/pi/.jhbuildrc && \
echo "os.environ['WORKON_HOME'] = '$USER_HOME/.virtualenvs'" >> /home/pi/.jhbuildrc && \
echo "os.environ['PROJECT_HOME'] = '$USER_HOME/dev'" >> /home/pi/.jhbuildrc && \
echo "os.environ['VIRTUALENVWRAPPER_PYTHON'] = '$VIRTUALENVWRAPPER_PYTHON'" >> /home/pi/.jhbuildrc && \
echo "os.environ['VIRTUALENVWRAPPER_VIRTUALENV'] = '$VIRTUALENVWRAPPER_VIRTUALENV'" >> /home/pi/.jhbuildrc && \
echo "os.environ['PYTHONSTARTUP'] = '$USER_HOME/.pythonrc'" >> /home/pi/.jhbuildrc && \
echo "os.environ['PIP_DOWNLOAD_CACHE'] = '$USER_HOME/.pip/cache'" >> /home/pi/.jhbuildrc && \
cat /home/pi/.jhbuildrc
# Expose port for ssh
EXPOSE 22
# Overlay the root filesystem from this repo
COPY ./container/root /
# Copy over dotfiles repo, we'll use this later on to init a bunch of thing
COPY ./dotfiles /dotfiles
RUN mkdir -p /home/pi/.local/bin \
&& cp -a /env-setup /home/pi/.local/bin/env-setup \
&& chmod +x /home/pi/.local/bin/env-setup
# NOTE: This should get around any docker permission issues we normally have
RUN cp -a /scripts/compile_jhbuild_and_deps.sh /home/pi/.local/bin/compile_jhbuild_and_deps.sh \
&& chmod +x /home/pi/.local/bin/compile_jhbuild_and_deps.sh \
&& chown pi:pi /home/pi/.local/bin/compile_jhbuild_and_deps.sh
# NOTE: Add dynenv script
RUN cp -a /scripts/with-dynenv /usr/local/bin/with-dynenv \
&& chmod +x /usr/local/bin/with-dynenv \
&& chown pi:pi /usr/local/bin/with-dynenv
# TODO: Need this ccache
# FIXME: This needs to be duplicated in the env-setup script, etc
ENV CCACHE_DIR /ccache
# TODO: before building should help with some macro issues
# FIXME: This needs to be duplicated in the env-setup script, etc
# /home/pi/jhbuild/share/aclocal
# ENV ACLOCAL_FLAGS "-I ${PREFIX}/share/aclocal"
# FIXME: Do we need to add this to jhbuildrc?
# os.environ['LDFLAGS'] = "-L" + prefix + "/lib" (in .jhbuildrc) helps if libtool picks up the wrong static libraries.
# TODO: ccache.conf
RUN mkdir -p /ccache && \
echo "max_size = 5.0G" > /ccache/ccache.conf && \
chown -R ${UNAME}:${UNAME} /ccache
# NOTE: Temp run install as pi user
USER $UNAME
RUN bash /prep-pi.sh
# Install jhbuild stuff
RUN bash /home/pi/.local/bin/compile_jhbuild_and_deps.sh
RUN pip install --user powerline-status && \
git config --global core.editor "vim" && \
git config --global push.default simple && \
git config --global color.ui true
# NOTE: Return to root user when finished
USER root
RUN bash /prep-pi.sh
# NOTE: Prepare XDG_RUNTIME_DIR and everything else
# we need to run our scripts correctly
RUN bash /scripts/write_xdg_dir_init.sh "pi"
RUN bash /scripts/write_xdg_dir_init.sh "root"
# Make sure the ruby2.2 packages are installed (Debian)
RUN add-apt-repository -y ppa:brightbox/ruby-ng && \
apt-fast update -yqq && \
export LANG=en_US.UTF-8 && \
apt-fast install -qqy ruby2.2 ruby2.2-dev && \
# now that apt-fast is setup, lets clean everything in this layer
apt-fast autoremove -y && \
# now clean regular apt-get stuff
apt-get clean && \
apt-get autoclean -y && \
apt-get autoremove -y && \
rm -rf /var/lib/{cache,log}/ && \
rm -rf /var/lib/apt/lists/*.lz4 /tmp/* /var/tmp/*
# Install powerline deps
# source: https://hub.docker.com/r/namredips/docker-dev/~/dockerfile/
RUN apt-fast update -yqq && \
export LANG=en_US.UTF-8 && \
apt-fast install -y autoconf automake libtool autotools-dev build-essential checkinstall bc ncurses-dev ncurses-term powerline python3-powerline fonts-powerline && \
# now that apt-fast is setup, lets clean everything in this layer
apt-fast autoremove -y && \
# now clean regular apt-get stuff
apt-get clean && \
apt-get autoclean -y && \
apt-get autoremove -y && \
rm -rf /var/lib/{cache,log}/ && \
rm -rf /var/lib/apt/lists/*.lz4 /tmp/* /var/tmp/*
# RUN git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
# RUN vim +PluginInstall +qall
# TODO: bash_it stuff will go here
# RUN bash /scripts/setup_pi_user_bash_it_and_powerline.sh
# install bash_it and bats
RUN mkdir -p /home/pi/.tmp && \
chown pi:pi -R /home/pi/.tmp && \
cd /home/pi/.tmp && \
git clone --depth=1 https://github.com/Bash-it/bash-it.git /home/pi/.bash_it && \
/home/pi/.bash_it/install.sh --silent --no-modify-config && \
git clone --depth 1 https://github.com/sstephenson/bats.git /home/pi/.tmp/bats && \
/home/pi/.tmp/bats/install.sh /usr/local && \
chown pi:pi -R /usr/local && \
chown -R pi:pi /home/pi \
&& \
# install powerline
# source: https://github.com/adidenko/powerline
# source: https://ubuntu-mate.community/t/installing-powerline-as-quickly-as-possible/5381
mkdir -p /home/pi/.tmp && \
chown pi:pi -R /home/pi/.tmp && \
cd /home/pi/.tmp && \
git clone https://github.com/powerline/fonts.git /home/pi/dev/powerline-fonts \
&& wget https://github.com/powerline/powerline/raw/develop/font/PowerlineSymbols.otf \
&& wget https://github.com/powerline/powerline/raw/develop/font/10-powerline-symbols.conf \
&& mkdir -p /home/pi/.fonts \
&& mv PowerlineSymbols.otf /home/pi/.fonts/ \
&& fc-cache -vf /home/pi/.fonts/ \
&& mkdir -p /home/pi/.config/fontconfig/conf.d/ \
&& mv 10-powerline-symbols.conf /home/pi/.config/fontconfig/conf.d/ \
&& touch /home/pi/.screenrc \
&& sed -i '1i term screen-256color' /home/pi/.screenrc \
&& git clone https://github.com/adidenko/powerline /home/pi/.config/powerline \
&& chown -R pi:pi /home/pi \
&& \
# rubygem defaults
cp -f /dotfiles/gemrc /home/pi/.gemrc \
&& chmod 0644 /home/pi/.gemrc \
&& chown pi:pi /home/pi/.gemrc \
&& \
# pythonrc defaults
cp -f /dotfiles/pythonrc /home/pi/.pythonrc \
&& chmod 0644 /home/pi/.pythonrc \
&& chown pi:pi /home/pi/.pythonrc
# RUN pip3 install --upgrade pip
# RUN pip3 install ipython
# RUN pip3 install flake8
# RUN pip3 install pylint
# NOTE: Add proper .profile and .bashrc files
RUN cp -f /dotfiles/profile /home/pi/.profile \
&& chmod 0644 /home/pi/.profile \
&& chown pi:pi /home/pi/.profile \
&& cp -f /dotfiles/bash_profile /home/pi/.bash_profile \
&& chmod 0644 /home/pi/.bash_profile \
&& chown pi:pi /home/pi/.bash_profile \
&& cp -f /dotfiles/bashrc /home/pi/.bashrc \
&& chmod 0644 /home/pi/.bashrc \
&& chown pi:pi /home/pi/.bashrc \
&& cp -a /dotfiles/bash.functions.d/. /home/pi/bash.functions.d/ \
&& chown pi:pi -R /home/pi/bash.functions.d/ \
&& touch /home/pi/.bash_history \
&& chown pi:pi /home/pi/.bash_history \
&& chmod 0600 /home/pi/.bash_history
# NOTE: Temp run install as pi user
USER $UNAME
# Fixes wierd ssh permission issue
RUN sudo mv /home/pi/.ssh /home/pi/.ssh.bak
RUN sudo mv /home/pi/.ssh.bak /home/pi/.ssh
RUN ls -lta /home/pi/.ssh
USER root
# FIXME: eventually we might need these guys
# apt-get install g++ gdb gdbserver
# FIXME: Do we need this??
# PYTHONIOENCODING="UTF-8"
# UMASK=002
# EDGE=0
# source: https://github.com/hurricanehrndz/docker-containers/blob/64fe4f2f0975587a00d180330b19e0aa7596581f/headphones/Dockerfile
CMD ["/bin/bash", "/run.sh"]
# TODO: 1. Add step to tar jhbuild up
# TODO: 2. Add step to move tar.gz file to volume
# TODO: 3. Add step to validate checksum
# TODO: 4. Verify tar.gz is actually on disk5