forked from amackeith/template-basic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
74 lines (58 loc) · 1.86 KB
/
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
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
# parameters
ARG REPO_NAME="<REPO_NAME_HERE>"
# ==================================================>
# ==> Do not change this code
ARG ARCH=arm32v7
ARG MAJOR=daffy
ARG BASE_TAG=${MAJOR}-${ARCH}
ARG BASE_IMAGE=dt-commons
# define base image
FROM duckietown/${BASE_IMAGE}:${BASE_TAG}
# check REPO_NAME
ARG REPO_NAME
RUN bash -c \
'if [ "${REPO_NAME}" = "<REPO_NAME_HERE>" ]; then \
>&2 echo "ERROR: You need to change the value of REPO_NAME inside Dockerfile."; \
exit 1; \
fi'
# define repository path
ARG REPO_PATH="${SOURCE_DIR}/${REPO_NAME}"
WORKDIR "${REPO_PATH}"
# create repo directory
RUN mkdir -p "${REPO_PATH}"
# copy dependencies (APT)
COPY ./dependencies-apt.txt "${REPO_PATH}/"
# install apt dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
$(awk -F: '/^[^#]/ { print $1 }' dependencies-apt.txt | uniq) \
&& rm -rf /var/lib/apt/lists/*
# copy dependencies (PIP3)
COPY ./dependencies-py3.txt "${REPO_PATH}/"
# install python dependencies
RUN pip3 install -r ${REPO_PATH}/dependencies-py3.txt
# copy the source code
COPY ./code/. "${REPO_PATH}/"
# copy avahi services
COPY ./assets/avahi-services/. /avahi-services/
# define launch script
COPY ./launch.sh "${REPO_PATH}/"
ENV LAUNCHFILE "${REPO_PATH}/launch.sh"
# define command
CMD ["bash", "-c", "${LAUNCHFILE}"]
# store module name
LABEL org.duckietown.label.module.type "${REPO_NAME}"
ENV DT_MODULE_TYPE "${REPO_NAME}"
# store module metadata
ARG ARCH
ARG MAJOR
ARG BASE_TAG
ARG BASE_IMAGE
LABEL org.duckietown.label.architecture "${ARCH}"
LABEL org.duckietown.label.code.location "${REPO_PATH}"
LABEL org.duckietown.label.code.version.major "${MAJOR}"
LABEL org.duckietown.label.base.image "${BASE_IMAGE}:${BASE_TAG}"
# <== Do not change this code
# <==================================================
# maintainer
LABEL maintainer="<YOUR_FULL_NAME> (<YOUR_EMAIL_ADDRESS>)"