Skip to content

Commit

Permalink
bring /srv/noteable back, add NBL_WORK_DIR
Browse files Browse the repository at this point in the history
  • Loading branch information
shouples committed Oct 19, 2023
1 parent 1d4bd3f commit d84abfc
Show file tree
Hide file tree
Showing 11 changed files with 61 additions and 35 deletions.
6 changes: 4 additions & 2 deletions Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ includes:
deno: ./Taskfile.deno.yaml

vars:
NBL_HOME_DIR: /var/run/noteable
NBL_HOME_DIR: /srv/noteable
NBL_WORK_DIR: /var/run/noteable

tasks:
copy-root-files:
Expand Down Expand Up @@ -42,6 +43,7 @@ tasks:
vars: [LANGUAGE, IDENTIFIER, NBL_LANGUAGE_VERSION]
vars:
BUILD_TARGET: '{{default "base" .BUILD_TARGET}}'
NBL_HOME_DIR: '{{default "/var/run/noteable" .NBL_HOME_DIR}}'
NBL_HOME_DIR: '{{default "/srv/noteable" .NBL_HOME_DIR}}'
NBL_WORK_DIR: '{{default "/var/run/noteable" .NBL_WORK_DIR}}'
TAG_SUFFIX: '{{default "" .TAG_SUFFIX}}'
TAG: '{{default "dev" .TAG}}'
13 changes: 8 additions & 5 deletions deno/base/1.37/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
# Rust 1.72 is required
FROM rust:1.72 as base

ARG NBL_HOME_DIR=/var/run/noteable
# Application code lives in NBL_HOME_DIR, project data lives in NBL_WORK_DIR
ARG NBL_HOME_DIR=/srv/noteable
ARG NBL_WORK_DIR=/var/run/noteable

# User/group setup
USER root
Expand All @@ -24,11 +26,12 @@ RUN groupadd --gid 4004 noteable && \
--no-log-init \
--gid noteable noteable \
--home-dir "${NBL_HOME_DIR}" && \
chown --recursive noteable:noteable "${NBL_HOME_DIR}"
chown --recursive noteable:noteable "${NBL_HOME_DIR}" && \
mkdir -p "${NBL_WORK_DIR}" && chown noteable:noteable "${NBL_WORK_DIR}"

# TEMPORARY: symlink the previous /etc/noteable to the new NBL_HOME_DIR (/var/run/noteable) dir
# TEMPORARY: symlink the previous /etc/noteable to the new NBL_WORK_DIR (/var/run/noteable) dir
# until all other services are migrated and the old /etc/noteable can be removed
RUN ln -s "${NBL_HOME_DIR}" /etc/noteable
RUN ln -s "${NBL_WORK_DIR}" /etc/noteable

WORKDIR /tmp

Expand Down Expand Up @@ -58,7 +61,7 @@ COPY run.sh /usr/local/bin

ENV HOME="${NBL_HOME_DIR}"

WORKDIR ${NBL_HOME_DIR}/project
WORKDIR ${NBL_WORK_DIR}/project
EXPOSE 50001-50005

ENTRYPOINT ["tini", "-g", "--"]
Expand Down
6 changes: 4 additions & 2 deletions python/base-gpu/3.10/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
# hadolint ignore=DL3006
FROM base AS main

ARG NBL_HOME_DIR=/var/run/noteable
# Application code lives in NBL_HOME_DIR, project data lives in NBL_WORK_DIR
ARG NBL_HOME_DIR=/srv/noteable
ARG NBL_WORK_DIR=/var/run/noteable
ARG NBL_PYTHON_VERSION=3.10

USER root
Expand Down Expand Up @@ -81,4 +83,4 @@ ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CONDA_DIR/lib/:$CUDNN_PATH/lib \
# Overwrite the base run.sh to include `mamba` usage
COPY run.sh /usr/local/bin

WORKDIR ${NBL_HOME_DIR}/project
WORKDIR ${NBL_WORK_DIR}/project
6 changes: 4 additions & 2 deletions python/base-gpu/3.11/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
# hadolint ignore=DL3006
FROM base AS main

ARG NBL_HOME_DIR=/var/run/noteable
# Application code lives in NBL_HOME_DIR, project data lives in NBL_WORK_DIR
ARG NBL_HOME_DIR=/srv/noteable
ARG NBL_WORK_DIR=/var/run/noteable
ARG NBL_PYTHON_VERSION=3.11

USER root
Expand Down Expand Up @@ -81,4 +83,4 @@ ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CONDA_DIR/lib/:$CUDNN_PATH/lib \
# Overwrite the base run.sh to include `mamba` usage
COPY run.sh /usr/local/bin

WORKDIR ${NBL_HOME_DIR}/project
WORKDIR ${NBL_WORK_DIR}/project
6 changes: 4 additions & 2 deletions python/base-gpu/3.9/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
# hadolint ignore=DL3006
FROM base AS main

ARG NBL_HOME_DIR=/var/run/noteable
# Application code lives in NBL_HOME_DIR, project data lives in NBL_WORK_DIR
ARG NBL_HOME_DIR=/srv/noteable
ARG NBL_WORK_DIR=/var/run/noteable
ARG NBL_PYTHON_VERSION=3.9

USER root
Expand Down Expand Up @@ -81,4 +83,4 @@ ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CONDA_DIR/lib/:$CUDNN_PATH/lib \
# Overwrite the base run.sh to include `mamba` usage
COPY run.sh /usr/local/bin

WORKDIR ${NBL_HOME_DIR}/project
WORKDIR ${NBL_WORK_DIR}/project
9 changes: 6 additions & 3 deletions python/base/3.10/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
ARG NBL_PYTHON_VERSION=3.10
FROM python:${NBL_PYTHON_VERSION}-slim-bullseye as base

ARG NBL_HOME_DIR=/var/run/noteable
# Application code lives in NBL_HOME_DIR, project data lives in NBL_WORK_DIR
ARG NBL_HOME_DIR=/srv/noteable
ARG NBL_WORK_DIR=/var/run/noteable
ARG NBL_PYTHON_VERSION

# User/group setup
Expand All @@ -25,12 +27,13 @@ RUN groupadd --gid 4004 noteable && \
--gid noteable noteable \
--home-dir "${NBL_HOME_DIR}" && \
chown --recursive noteable:noteable "${NBL_HOME_DIR}" && \
mkdir -p "${NBL_WORK_DIR}" && chown noteable:noteable "${NBL_WORK_DIR}" && \
mkdir /opt/venv && chown noteable:noteable /opt/venv && \
mkdir /etc/ipython && chown noteable:noteable /etc/ipython

# TEMPORARY: symlink the previous /etc/noteable to the new NBL_HOME_DIR (/var/run/noteable) dir
# until all other services are migrated and the old /etc/noteable can be removed
RUN ln -s "${NBL_HOME_DIR}" /etc/noteable
RUN ln -s "${NBL_WORK_DIR}" /etc/noteable

WORKDIR /tmp

Expand Down Expand Up @@ -60,7 +63,7 @@ ENV HOME="${NBL_HOME_DIR}" \
XDG_CACHE_HOME="${NBL_HOME_DIR}/.cache/" \
GOOGLE_APPLICATION_CREDENTIALS="/vault/secrets/gcp-credentials"

WORKDIR ${NBL_HOME_DIR}/project
WORKDIR ${NBL_WORK_DIR}/project
EXPOSE 50001-50005

ENTRYPOINT ["/tini", "-g", "--"]
Expand Down
11 changes: 7 additions & 4 deletions python/base/3.11/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
ARG NBL_PYTHON_VERSION=3.11
FROM python:${NBL_PYTHON_VERSION}-slim-bullseye as base

ARG NBL_HOME_DIR=/var/run/noteable
# Application code lives in NBL_HOME_DIR, project data lives in NBL_WORK_DIR
ARG NBL_HOME_DIR=/srv/noteable
ARG NBL_WORK_DIR=/var/run/noteable
ARG NBL_PYTHON_VERSION

# User/group setup
Expand All @@ -25,12 +27,13 @@ RUN groupadd --gid 4004 noteable && \
--gid noteable noteable \
--home-dir "${NBL_HOME_DIR}" && \
chown --recursive noteable:noteable "${NBL_HOME_DIR}" && \
mkdir -p "${NBL_WORK_DIR}" && chown noteable:noteable "${NBL_WORK_DIR}" && \
mkdir /opt/venv && chown noteable:noteable /opt/venv && \
mkdir /etc/ipython && chown noteable:noteable /etc/ipython

# TEMPORARY: symlink the previous /etc/noteable to the new NBL_HOME_DIR (/var/run/noteable) dir
# TEMPORARY: symlink the previous /etc/noteable to the new NBL_WORK_DIR (/var/run/noteable) dir
# until all other services are migrated and the old /etc/noteable can be removed
RUN ln -s "${NBL_HOME_DIR}" /etc/noteable
RUN ln -s "${NBL_WORK_DIR}" /etc/noteable

WORKDIR /tmp

Expand Down Expand Up @@ -60,7 +63,7 @@ ENV HOME="${NBL_HOME_DIR}" \
XDG_CACHE_HOME="${NBL_HOME_DIR}/.cache/" \
GOOGLE_APPLICATION_CREDENTIALS="/vault/secrets/gcp-credentials"

WORKDIR ${NBL_HOME_DIR}/project
WORKDIR ${NBL_WORK_DIR}/project
EXPOSE 50001-50005

ENTRYPOINT ["/tini", "-g", "--"]
Expand Down
11 changes: 7 additions & 4 deletions python/base/3.9/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
ARG NBL_PYTHON_VERSION=3.9
FROM python:${NBL_PYTHON_VERSION}-slim-bullseye as base

ARG NBL_HOME_DIR=/var/run/noteable
# Application code lives in NBL_HOME_DIR, project data lives in NBL_WORK_DIR
ARG NBL_HOME_DIR=/srv/noteable
ARG NBL_WORK_DIR=/var/run/noteable
ARG NBL_PYTHON_VERSION

# User/group setup
Expand All @@ -25,12 +27,13 @@ RUN groupadd --gid 4004 noteable && \
--gid noteable noteable \
--home-dir "${NBL_HOME_DIR}" && \
chown --recursive noteable:noteable "${NBL_HOME_DIR}" && \
mkdir -p "${NBL_WORK_DIR}" && chown noteable:noteable "${NBL_WORK_DIR}" && \
mkdir /opt/venv && chown noteable:noteable /opt/venv && \
mkdir /etc/ipython && chown noteable:noteable /etc/ipython

# TEMPORARY: symlink the previous /etc/noteable to the new ""${NBL_HOME_DIR}"" dir
# TEMPORARY: symlink the previous /etc/noteable to the new NBL_WORK_DIR (/var/run/noteable) dir
# until all other services are migrated and the old /etc/noteable can be removed
RUN ln -s "${NBL_HOME_DIR}" /etc/noteable
RUN ln -s "${NBL_WORK_DIR}" /etc/noteable

WORKDIR /tmp

Expand Down Expand Up @@ -60,7 +63,7 @@ ENV HOME="${NBL_HOME_DIR}" \
XDG_CACHE_HOME="${NBL_HOME_DIR}/.cache/" \
GOOGLE_APPLICATION_CREDENTIALS="/vault/secrets/gcp-credentials"

WORKDIR ${NBL_HOME_DIR}/project
WORKDIR ${NBL_WORK_DIR}/project
EXPOSE 50001-50005

ENTRYPOINT ["/tini", "-g", "--"]
Expand Down
11 changes: 7 additions & 4 deletions r/base/4.3.0/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
ARG NBL_R_VERSION=4.3.0
FROM r-base:${NBL_R_VERSION} as base

ARG NBL_HOME_DIR=/var/run/noteable
# Application code lives in NBL_HOME_DIR, project data lives in NBL_WORK_DIR
ARG NBL_HOME_DIR=/srv/noteable
ARG NBL_WORK_DIR=/var/run/noteable

# User/group setup
USER root
Expand All @@ -24,11 +26,12 @@ RUN groupadd --gid 4004 noteable && \
--gid noteable noteable \
--home-dir "${NBL_HOME_DIR}" && \
chown --recursive noteable:noteable "${NBL_HOME_DIR}" && \
mkdir -p "${NBL_WORK_DIR}" && chown noteable:noteable "${NBL_WORK_DIR}" && \
chown --recursive noteable:noteable /usr/local/lib/R/site-library

# TEMPORARY: symlink the previous /etc/noteable to the new NBL_HOME_DIR (/var/run/noteable) dir
# TEMPORARY: symlink the previous /etc/noteable to the new NBL_WORK_DIR (/var/run/noteable) dir
# until all other services are migrated and the old /etc/noteable can be removed
RUN ln -s "${NBL_HOME_DIR}" /etc/noteable
RUN ln -s "${NBL_WORK_DIR}" /etc/noteable

# Install tini to manage passing signals to the child kernel process
ENV TINI_VERSION v0.19.0
Expand All @@ -53,7 +56,7 @@ ENV HOME="${NBL_HOME_DIR}" \
XDG_CACHE_HOME="${NBL_HOME_DIR}/.cache/" \
GOOGLE_APPLICATION_CREDENTIALS="/vault/secrets/gcp-credentials"

WORKDIR ${NBL_HOME_DIR}/project
WORKDIR ${NBL_WORK_DIR}/project
EXPOSE 50001-50005

ENTRYPOINT ["/tini", "-g", "--"]
Expand Down
4 changes: 2 additions & 2 deletions r/noteable/4.3.0/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# hadolint ignore=DL3006
FROM base as main

ARG NBL_HOME_DIR=/var/run/noteable
ARG NBL_WORK_DIR=/var/run/noteable

USER root

Expand All @@ -20,4 +20,4 @@ COPY requirements.R /tmp/requirements.R
RUN R -e "source('/tmp/requirements.R')"

# similarly, copy any R commands that need to run on startup
COPY .Rprofile ${NBL_HOME_DIR}/.Rprofile
COPY .Rprofile ${NBL_WORK_DIR}/.Rprofile
13 changes: 8 additions & 5 deletions rust/base/1.70/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
ARG NBL_RUST_VERSION="1.70"
FROM rust:${NBL_RUST_VERSION}-slim-bullseye as base

ARG NBL_HOME_DIR=/var/run/noteable
# Application code lives in NBL_HOME_DIR, project data lives in NBL_WORK_DIR
ARG NBL_HOME_DIR=/srv/noteable
ARG NBL_WORK_DIR=/var/run/noteable

# User/group setup
USER root
Expand All @@ -23,11 +25,12 @@ RUN groupadd --gid 4004 noteable && \
--no-log-init \
--gid noteable noteable \
--home-dir "${NBL_HOME_DIR}" && \
chown --recursive noteable:noteable "${NBL_HOME_DIR}"
chown --recursive noteable:noteable "${NBL_HOME_DIR}" && \
mkdir -p "${NBL_WORK_DIR}" && chown noteable:noteable "${NBL_WORK_DIR}"

# TEMPORARY: symlink the previous /etc/noteable to the new NBL_HOME_DIR (/var/run/noteable) dir
# TEMPORARY: symlink the previous /etc/noteable to the new NBL_WORK_DIR (/var/run/noteable) dir
# until all other services are migrated and the old /etc/noteable can be removed
RUN ln -s "${NBL_HOME_DIR}" /etc/noteable
RUN ln -s "${NBL_WORK_DIR}" /etc/noteable

WORKDIR /tmp

Expand All @@ -47,7 +50,7 @@ COPY run.sh /usr/local/bin

ENV HOME="${NBL_HOME_DIR}"

WORKDIR ${NBL_HOME_DIR}/project
WORKDIR ${NBL_WORK_DIR}/project
EXPOSE 50001-50005

RUN cargo init
Expand Down

0 comments on commit d84abfc

Please sign in to comment.