-
Notifications
You must be signed in to change notification settings - Fork 4
/
Dockerfile
53 lines (42 loc) · 1.8 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
FROM ubuntu:20.04
# Install base requirements
RUN apt-get -o Acquire::Check-Valid-Until=false -o Acquire::Check-Date=false update && \
apt-get install -y python3-pip wget apt-utils systemctl
# Download and install InlfuxDB
RUN wget -qO- https://repos.influxdata.com/influxdata-archive_compat.key | apt-key add - && \
echo "deb https://repos.influxdata.com/debian bionic stable" | tee /etc/apt/sources.list.d/influxdb.list && \
apt update && apt install -y influxdb
# Setup database for data storage
RUN systemctl unmask influxdb.service && \
systemctl start influxdb && \
systemctl enable influxdb.service && \
influx --execute "create database home" && \
influx --execute "use home" && \
influx --execute "create user monitoring with password 'password' with all privileges" && \
influx --execute "grant all privileges on home to monitoring" && \
influx --execute "show users"
# Preparing headless mode requirements
ARG DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe/Berlin
RUN apt-get install -y xvfb libglib2.0-0 libsm6 libxrender1 libxext6 sudo
# Install package base requirements
RUN pip install virtualenv pip
# Copy package to docker and install it
COPY . /app
WORKDIR /app
# Create entrypoint
RUN chmod +x /app/docker_entrypoint.sh
# Install p34ABM
RUN pip install -e /app
# Add a non-root user so that the generated data can be easily handled on host
ENV GID 10067090
ENV UID 10067090
RUN groupadd --gid $GID appgroup && \
useradd -r -d /app -g appgroup -G root,sudo -u $UID appuser
RUN adduser appuser sudo
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
# Change the owner of the application folder to new user
RUN chown -R appuser:appgroup /app
# Change user to new user (from this on, we need to use sudo for root methods)
USER appuser
CMD ["/app/docker_entrypoint.sh"]