Skip to content

Commit

Permalink
Endret oppsett (#43)
Browse files Browse the repository at this point in the history
- Endret navn på mongr-dev docker image til mongr-dev-rstudio
- Flytte ut config til egen fil
- Kjøre workflow på samme måte
- Flytte begge Dockerfile til samme mappe
  • Loading branch information
arnfinn authored Sep 1, 2023
1 parent 1fae238 commit fcdeabe
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 77 deletions.
39 changes: 11 additions & 28 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,34 +11,26 @@ on:

jobs:
push_to_registries:
name: Push Docker image to docker hub
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
config:
- {name: rstudio}
- {name: code-server}
name: Image mongr-dev-${{ matrix.config.name }}
steps:
- name: Check out the repo
uses: actions/checkout@v3.6.0
- name: Lint Dockerfile
uses: hadolint/hadolint-action@v3.1.0
with:
dockerfile: "Dockerfile"
- name: Lint Dockerfile code-server
uses: hadolint/hadolint-action@v3.1.0
with:
dockerfile: "dockerfiles/Dockerfile.code-server"
- name: Prepare
dockerfile: "dockerfiles/Dockerfile.${{ matrix.config.name }}"
- name: Prepare tags
id: docker_meta
uses: docker/metadata-action@v4.6.0
with:
images: hnskde/mongr-dev
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Prepare code-server
id: docker_meta_code-server
uses: docker/metadata-action@v4.6.0
with:
images: hnskde/mongr-dev-code-server
images: hnskde/mongr-dev-${{ matrix.config.name }}
tags: |
type=ref,event=branch
type=ref,event=pr
Expand All @@ -56,17 +48,8 @@ jobs:
uses: docker/build-push-action@v4.1.1
with:
context: .
file: ./Dockerfile
file: ./dockerfiles/Dockerfile.${{ matrix.config.name }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
build-args: GH_PAT=${{ secrets.GITHUB_TOKEN }}
- name: Build and push code-server to Docker Hub
uses: docker/build-push-action@v4.1.1
with:
context: .
file: ./dockerfiles/Dockerfile.code-server
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.docker_meta_code-server.outputs.tags }}
labels: ${{ steps.docker_meta_code-server.outputs.labels }}
build-args: GH_PAT=${{ secrets.GITHUB_TOKEN }}
14 changes: 14 additions & 0 deletions config/.Renviron
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
TZ=Europe/Oslo
http_proxy=
https_proxy=
IMONGR_CONTEXT=DEV
IMONGR_DB_HOST=db
IMONGR_DB_HOST_VERIFY=db-verify
IMONGR_DB_HOST_QA=db-qa
IMONGR_DB_NAME=imongr
IMONGR_DB_USER=imongr
IMONGR_DB_PASS=imongr
IMONGR_ADMINER_URL=http://localhost:8888
SHINYPROXY_USERNAME=imongr@mongr.no
SHINYPROXY_USERGROUPS=MANAGER,PROVIDER
R_LIBS_USER=/home/coder/R/library
52 changes: 3 additions & 49 deletions dockerfiles/Dockerfile.code-server
Original file line number Diff line number Diff line change
Expand Up @@ -37,60 +37,14 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

USER 1000

# Set norsk bokmaal as default system locale
ENV LC_ALL=nb_NO.UTF-8
ENV LANG=nb_NO.UTF-8
#RUN sed -i 's/^# *\(nb_NO.UTF-8\)/\1/' /etc/locale.gen \
# && locale-gen \
# && echo "LANG=\"nb_NO.UTF-8\"" > /etc/default/locale \
# && update-locale LANG=nb_NO.utf8

# making env vars go all the way into Rstudio console, based on
# https://github.com/rocker-org/rocker-versioned/issues/91
ARG TZ=Europe/Oslo
ENV TZ=${TZ}
ARG PROXY=
ENV http_proxy=${PROXY}
ENV https_proxy=${PROXY}
ARG INSTANCE=DEV
ENV IMONGR_CONTEXT=${INSTANCE}
ARG IMONGR_DB_HOST=db
ENV IMONGR_DB_HOST=${IMONGR_DB_HOST}
ARG IMONGR_DB_HOST_VERIFY=db-verify
ENV IMONGR_DB_HOST_VERIFY=${IMONGR_DB_HOST_VERIFY}
ARG IMONGR_DB_HOST_QA=db-qa
ENV IMONGR_DB_HOST_QA=${IMONGR_DB_HOST_QA}
ARG IMONGR_DB_NAME=imongr
ENV IMONGR_DB_NAME=${IMONGR_DB_NAME}
ARG IMONGR_DB_USER=imongr
ENV IMONGR_DB_USER=${IMONGR_DB_USER}
ARG IMONGR_DB_PASS=imongr
ENV IMONGR_DB_PASS=${IMONGR_DB_PASS}
ARG IMONGR_ADMINER_URL=http://localhost:8888
ENV IMONGR_ADMINER_URL=${IMONGR_ADMINER_URL}
ARG SHINYPROXY_USERNAME=imongr@mongr.no
ENV SHINYPROXY_USERNAME=${SHINYPROXY_USERNAME}
ARG SHINYPROXY_USERGROUPS=MANAGER,PROVIDER
ENV SHINYPROXY_USERGROUPS=${SHINYPROXY_USERGROUPS}
ARG R_LIBS_USER=/home/coder/R/library
ENV R_LIBS_USER=${R_LIBS_USER}
COPY config/.Renviron /home/coder/.Renviron

RUN touch /home/coder/.Renviron \
&& echo "TZ=${TZ}" > /home/coder/.Renviron \
&& echo "http_proxy=${PROXY}" >> /home/coder/.Renviron \
&& echo "https_proxy=${PROXY}" >> /home/coder/.Renviron \
&& echo "IMONGR_CONTEXT=${IMONGR_CONTEXT}" >> /home/coder/.Renviron \
&& echo "IMONGR_DB_HOST=${IMONGR_DB_HOST}" >> /home/coder/.Renviron \
&& echo "IMONGR_DB_HOST_VERIFY=${IMONGR_DB_HOST_VERIFY}" >> /home/coder/.Renviron \
&& echo "IMONGR_DB_HOST_QA=${IMONGR_DB_HOST_QA}" >> /home/coder/.Renviron \
&& echo "IMONGR_DB_NAME=${IMONGR_DB_NAME}" >> /home/coder/.Renviron \
&& echo "IMONGR_DB_USER=${IMONGR_DB_USER}" >> /home/coder/.Renviron \
&& echo "IMONGR_DB_PASS=${IMONGR_DB_PASS}" >> /home/coder/.Renviron \
&& echo "IMONGR_ADMINER_URL=${IMONGR_ADMINER_URL}" >> /home/coder/.Renviron \
&& echo "SHINYPROXY_USERNAME=${SHINYPROXY_USERNAME}" >> /home/coder/.Renviron \
&& echo "SHINYPROXY_USERGROUPS=${SHINYPROXY_USERGROUPS}" >> /home/coder/.Renviron \
&& echo "R_LIBS_USER=${R_LIBS_USER}" >> /home/coder/.Renviron \
&& mkdir -p /home/coder/R/library \
RUN mkdir -p /home/coder/R/library \
&& R -e "install.packages(c('remotes', 'devtools', 'languageserver', 'jsonlite'), lib = '/home/coder/R/library')" \
&& R -e "remotes::install_github('mong/imongr', lib = '/home/coder/R/library')" \
&& code-server --install-extension reditorsupport.r --install-extension mechatroner.rainbow-csv
File renamed without changes.

0 comments on commit fcdeabe

Please # to comment.