forked from drivendataorg/cookiecutter-data-science
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from Vastra-Gotalandsregionen/AI-844
AI-844: Adds researcher user and renv.lock to R
- Loading branch information
Showing
7 changed files
with
175 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,42 @@ | ||
{% if cookiecutter.image == 'Tensorflow' %}FROM registry.git.vgregion.se/aiplattform/images/tensorflow:0.2.1{% endif %} | ||
{% if cookiecutter.image == 'PyTorch' %}FROM registry.git.vgregion.se/aiplattform/images/pytorch:0.3.2{% endif %} | ||
{% if cookiecutter.image == 'R' %}FROM registry.git.vgregion.se/aiplattform/images/r:0.2.0{% endif %} | ||
{% if cookiecutter.image == 'Tensorflow' -%}FROM registry.git.vgregion.se/aiplattform/images/tensorflow:0.2.1 | ||
{% elif cookiecutter.image == 'PyTorch' -%}FROM registry.git.vgregion.se/aiplattform/images/pytorch:0.3.2 | ||
{% elif cookiecutter.image == 'R' -%}FROM registry.git.vgregion.se/aiplattform/images/r:0.3.0{%- endif %} | ||
ENV GID=1000 | ||
ENV UID=1000 | ||
{% if cookiecutter.image == 'R' %}ENV EDITOR_FOCUS_DIR="/workspace"{% endif %} | ||
|
||
RUN apt -y update \ | ||
&& apt install -y --no-install-recommends python3-pip git openssl {% if cookiecutter.image != 'R' %}\ | ||
&& addgroup --gid $GID researcher \ | ||
&& adduser --home /workspace --shell /bin/bash --disabled-password --gecos '' --uid $UID --gid $GID researcher \ | ||
&& apt install -y --no-install-recommends python3-pip git openssl \{% if cookiecutter.image != 'R' %} | ||
&& addgroup --gid $GID researcher \{% endif %} | ||
&& useradd --home-dir /workspace --create-home --shell /bin/bash --non-unique --comment '' --uid $UID --gid $GID researcher \ | ||
&& chown -R 1000:1000 /workspace | ||
{% endif %} | ||
|
||
ADD http://aiav2.vgregion.se/VGC%20Root%20CA%20v2.crt /tmp/vgc_root.der | ||
ADD http://aiav2.vgregion.se/VGC%20Issuing%201%20CA%20v2.crt /tmp/vgc_issuing1.der | ||
ADD http://aiav2.vgregion.se/VGC%20Issuing%202%20CA%20v2.crt /tmp/vgc_issuing2.der | ||
ADD http://aiav2.vgregion.se/VGC%20Issuing%201%20CA%20v2(1).crt /tmp/vgc_issuing1_2.der | ||
|
||
COPY requirements.txt {% if cookiecutter.image != 'R' %} setup.py {% endif %} ./ | ||
COPY requirements.txt {% if cookiecutter.image != 'R' %} setup.py {% endif %} ./{% if cookiecutter.image == 'R' %} | ||
COPY renv.lock /workspace/renv.lock | ||
COPY r-start.sh /usr/local/bin/r-start{% endif %} | ||
|
||
RUN pip install -r requirements.txt --no-cache-dir \ | ||
&& openssl x509 -inform der -in /tmp/vgc_root.der -out /usr/local/share/ca-certificates/vgc_root.crt \ | ||
&& openssl x509 -inform der -in /tmp/vgc_issuing1.der -out /usr/local/share/ca-certificates/vgc_issuing1.crt \ | ||
&& openssl x509 -inform der -in /tmp/vgc_issuing1_2.der -out /usr/local/share/ca-certificates/vgc_issuing1_2.crt \ | ||
&& openssl x509 -inform der -in /tmp/vgc_issuing2.der -out /usr/local/share/ca-certificates/vgc_issuing2.crt \ | ||
&& update-ca-certificates \ | ||
&& rm requirements.txt setup.py | ||
{% if cookiecutter.image == 'R' %}&& chown -R 1000:1000 /workspace/ \ | ||
&& echo "setwd(\"/workspace/\")" > /home/rstudio/.Rprofile \ | ||
&& chmod +x /usr/local/bin/r-start \{% endif %} | ||
&& rm requirements.txt {% if cookiecutter.image != 'R' %} setup.py {% endif %} | ||
|
||
USER researcher | ||
WORKDIR /workspace | ||
WORKDIR /workspace | ||
|
||
{% if cookiecutter.image == 'R' %}RUN R -e 'renv::activate()' && R -e 'renv::restore()' | ||
|
||
USER root | ||
EXPOSE 8787 | ||
|
||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
|
||
su - researcher | ||
R -e 'renv::activate()' | ||
|
||
# Insert additional code here |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters