-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
57 lines (45 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
# syntax = docker/dockerfile:1.2
#choose a base image
#FROM julia:1.9.3
#FROM julia:1.9.4-alpine
FROM julia:1.9.4
#maybe due to pyCall it is better not to use the alpine version?
# mark it with a label, so we can remove dangling images
LABEL cicd="sonnenbatteriestats"
#https://vsupalov.com/buildkit-cache-mount-dockerfile/
ENV PIP_CACHE_DIR=/var/cache/buildkit/pip
RUN mkdir -p $PIP_CACHE_DIR
RUN rm -f /etc/apt/apt.conf.d/docker-clean
#RUN --mount=type=cache,target=/var/cache/apt apt-get update && apt-get install -yqq --no-install-recommends wget git iputils-ping && rm -rf /var/lib/apt/lists/*
ENV TZ="Europe/Zurich" USER=root USER_HOME_DIR=/home/${USER} JULIA_DEPOT_PATH=${USER_HOME_DIR}/.julia NOTEBOOK_DIR=${USER_HOME_DIR}/notebooks JULIA_NUM_THREADS=1
#copy Julia package
RUN mkdir -p /usr/local/SonnenBatterie.jl
COPY . /usr/local/SonnenBatterie.jl
#set workdir
WORKDIR /usr/local/SonnenBatterie.jl
#install dependencies
RUN julia /usr/local/SonnenBatterie.jl/deps/dockerdeps.jl
########################################################################
#enviroment variables
########################################################################
ARG INFLUXDB_ORG
ENV INFLUXDB_ORG $INFLUXDB_ORG
ARG INFLUXDB_TOKEN
ENV INFLUXDB_TOKEN $INFLUXDB_TOKEN
ARG INFLUXDB_URL
ENV INFLUXDB_URL $INFLUXDB_URL
ARG SONNEN_PASSWORD
ENV SONNEN_PASSWORD $SONNEN_PASSWORD
########################################################################
#run Tests
########################################################################
RUN julia --project=@. -e "import Pkg;Pkg.test()"
########################################################################
#run application
########################################################################
USER root
#start julia script
#ENTRYPOINT ["julia", "-p 1"]
ENTRYPOINT ["julia"]
CMD ["src/infinite_loop.jl"]
#working dir is set as SonnenBatterie.jl