cjerzak commited on
Commit
de41f57
·
verified ·
1 Parent(s): 4856715

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +64 -0
Dockerfile ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM rocker/r-ver:4.3.3
2
+
3
+ ENV DEBIAN_FRONTEND=noninteractive \
4
+ TZ=Etc/UTC \
5
+ PORT=7860 \
6
+ RETICULATE_MINICONDA_PATH=/opt/conda \
7
+ RETICULATE_CONDA=/opt/conda/bin/conda \
8
+ PATH=/opt/conda/bin:${PATH} \
9
+ R_REMOTES_NO_ERRORS_FROM_WARNINGS=true
10
+
11
+ RUN apt-get update && apt-get install -y --no-install-recommends \
12
+ ca-certificates \
13
+ curl \
14
+ wget \
15
+ git \
16
+ bzip2 \
17
+ build-essential \
18
+ libcurl4-openssl-dev \
19
+ libssl-dev \
20
+ libxml2-dev \
21
+ libgit2-dev \
22
+ zlib1g-dev \
23
+ libicu-dev \
24
+ libbz2-dev \
25
+ liblzma-dev \
26
+ libreadline-dev \
27
+ libsqlite3-dev \
28
+ libffi-dev \
29
+ libpng-dev \
30
+ libjpeg-dev \
31
+ libtiff5-dev \
32
+ libharfbuzz-dev \
33
+ libfribidi-dev \
34
+ && rm -rf /var/lib/apt/lists/*
35
+
36
+ RUN set -eux; \
37
+ arch="$(uname -m)"; \
38
+ case "$arch" in \
39
+ x86_64) installer="Miniconda3-latest-Linux-x86_64.sh" ;; \
40
+ aarch64|arm64) installer="Miniconda3-latest-Linux-aarch64.sh" ;; \
41
+ *) echo "Unsupported architecture: $arch"; exit 1 ;; \
42
+ esac; \
43
+ curl -fsSL "https://repo.anaconda.com/miniconda/${installer}" -o /tmp/miniconda.sh; \
44
+ bash /tmp/miniconda.sh -b -p /opt/conda; \
45
+ rm -f /tmp/miniconda.sh; \
46
+ /opt/conda/bin/conda config --set always_yes yes --set changeps1 no; \
47
+ /opt/conda/bin/conda update -n base -c defaults conda
48
+
49
+ RUN R -q -e "install.packages(c('remotes','plumber','jsonlite','reticulate'), repos='https://cloud.r-project.org')"
50
+
51
+ ARG ASA_SOFTWARE_REPO=https://github.com/cjerzak/asa-software
52
+ ARG ASA_SOFTWARE_REF=main
53
+
54
+ RUN git clone --depth 1 --branch "${ASA_SOFTWARE_REF}" "${ASA_SOFTWARE_REPO}" /opt/asa-software \
55
+ && R -q -e "remotes::install_local('/opt/asa-software/asa', dependencies = TRUE, upgrade = 'never')" \
56
+ && R -q -e "asa::build_backend(conda_env='asa_env', python_version='3.12', check_browser=FALSE, fix_browser=FALSE)" \
57
+ && rm -rf /opt/asa-software/.git
58
+
59
+ WORKDIR /app
60
+ COPY . /app
61
+
62
+ EXPOSE 7860
63
+
64
+ CMD ["Rscript", "-e", "pr <- plumber::plumb('/app/plumber.R'); pr$run(host='0.0.0.0', port=as.integer(Sys.getenv('PORT', '7860')))" ]