-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDockerfile.template
97 lines (74 loc) · 3.4 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
FROM balenalib/%%BALENA_MACHINE_NAME%%-debian-python:3.6.8-stretch-build
# Install things we need to build here
RUN apt-get update \
&& apt-get install -y vim gcc g++ libffi-dev \
libatlas-base-dev \
libsdl-dev \
libsdl-image1.2-dev \
libsdl-mixer1.2-dev \
libsdl-ttf2.0-dev \
libsmpeg-dev \
libportmidi-dev \
libavformat-dev \
libswscale-dev \
libjpeg-dev \
libfreetype6-dev \
dnsmasq \
wireless-tools \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
### Install Balena.io wifi-connect
### Make the directory structure
# We'll be placing everything at /opt/openagbrain
# TODO: We'll need to move where the stored images are to the Balena specific /data
RUN mkdir -p /opt/openagbrain/data/images/stored
### Install python 3.6
# since the isntall scripts use sudo, and we don't need sudo, we'll alais it
###### DON'T NEED SINCE WE'RE USING A PYTHON 3.6 image
#COPY openag-device-software/scripts/install/install_python36.sh .
#RUN alias sudo='';install_python36.sh;rm install_python36.sh
### Install the various python modules
## COPY openag-device-software/requirements.txt .
## COPY requirements-balena-no-picam-for-build.txt .
COPY requirements-balena.txt ./requirements.txt
RUN pip install -r requirements.txt --find-links http://www.lifewithrobot.com/wheels/ --trusted-host www.lifewithrobot.com; rm requirements.txt
#RUN pip install -r requirements-balena-no-picam-for-build.txt; rm requirements-balena-no-picam-for-build.txt
### Setup balean wifi-connect:
#WORKDIR /usr/src/app
#RUN curl https://api.github.com/repos/balena-io/wifi-connect/releases/latest -s \
# | grep -hoP 'browser_download_url": "\K.*%%RESIN_ARCH%%\.tar\.gz' \
# | xargs -n1 curl -Ls \
# | tar -xvz -C /usr/src/app/
ADD python-wifi-connect /opt/python-wifi-connect
### Copy OpenAg Brain
ADD openag-device-software /opt/openagbrain
WORKDIR /opt/openagbrain
### Add in the Balena specific requirements.txt
COPY requirements-balena.txt ./requirements.txt
### We can't create the DB here, as the /data persistant storage area won't exist at this point
### BUT we can copy in the script here.
COPY setup_django_db.sh /opt/openagbrain/setup_django_db.sh
RUN chmod +x ./setup_django_db.sh
### Set up virtual env, activate it
COPY create_venv.sh .
RUN chmod +x ./create_venv.sh; ./create_venv.sh; rm ./create_venv.sh
### set up some envs
ENV PLATFORM %%BALENA_MACHINE_NAME%%
ENV PROJECT_ROOT /opt/openagbrain
### Balena Specific ENVs
ENV INITSYSTEM=on \
DBUS_SYSTEM_BUS_ADDRESS="unix:path=/host/run/dbus/system_bus_socket" \
STORAGE_LOCATION="/data" \
UDEV=on
COPY set_env_vars.sh /opt/openagbrain/set_env_vars.sh
RUN chmod +x /opt/openagbrain/set_env_vars.sh
### Add in the startup script (Used by ENTRYPOINT)
COPY run_django.sh /opt/openagbrain/run_django.sh
RUN chmod +x /opt/openagbrain/run_django.sh
COPY mdns-service/stop_mdns.py scripts/network/stop_mdns.py
COPY mdns-service/start_mdns.py scripts/network/start_mdns.py
COPY mdns-service/restart_mdns.py scripts/network/restart_mdns.py
COPY clear_network_configs.py scripts/network/clear_network_configs.py
### Expose port 80
EXPOSE 80
ENTRYPOINT ["/opt/openagbrain/run_django.sh"]