Skip to content

Commit

Permalink
Flyttet app fra inst-mappe til R-mappe (#24)
Browse files Browse the repository at this point in the history
* docker-fix

* aktiver faner (figurer etc.)

* aktivert litt mer
  • Loading branch information
arnfinn authored Dec 18, 2023
1 parent cede95b commit 9315e63
Show file tree
Hide file tree
Showing 17 changed files with 584 additions and 456 deletions.
22 changes: 10 additions & 12 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
^.*\.Rproj$
^\.Rproj\.user$
^\.travis\.yml$
^appveyor\.yml$
^_pkgdown\.yml$
^docs$
^pkgdown$
^LICENSE\.md$
^Rprofile.site$
^Dockerfile$
^\.lintr$
^\.github$
^.*\.Rproj$
^\.Rproj\.user$
^_pkgdown\.yml$
^docs$
^pkgdown$
^LICENSE\.md$
^Rprofile.site$
^Dockerfile$
^\.lintr$
^\.github$
1 change: 0 additions & 1 deletion .github/.gitignore

This file was deleted.

54 changes: 54 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Publish Docker image
on:
release:
types: [published]
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
push_to_registries:
name: Push Docker image to docker hub
runs-on: ubuntu-latest
env:
IMAGE_NAME: ${{ github.repository }}
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: R setup
uses: r-lib/actions/setup-r@v2.6.5
- name: Build package (tarball)
run: R CMD build .
- name: Lint Dockerfile
uses: hadolint/hadolint-action@v3.1.0
with:
dockerfile: "Dockerfile"
- name: Prepare tags
id: docker_meta
uses: docker/metadata-action@v5.0.0
with:
images: ${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3.0.0
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3.0.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Push to Docker Hub
uses: docker/build-push-action@v5.0.0
with:
context: .
file: ./Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ figure
inst/shinyApps/app1/*.md
inst/*.md
docs/
*.tar.gz
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Remotes:
License: GPL-3
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.1.1
RoxygenNote: 7.2.3
URL: http://github.com/Rapporteket/rapRegTemplate
BugReports: http://github.com/Rapporteket/rapRegTemplate/issues
Suggests:
Expand Down
34 changes: 9 additions & 25 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,33 +1,17 @@
FROM rocker/r-base
FROM rapporteket/base-r:4.2.1

LABEL maintainer "Are Edvardsen <are.edvardsen@helse-nord.no>"
LABEL no.mongr.cd.enable="true"
LABEL maintainer "Arnfinn Hykkerud Steindal <arnfinn.hykkerud.steindal@helse-nord.no>"

# system libraries of general use
RUN apt-get update && apt-get install -y \
sudo \
pandoc \
pandoc-citeproc \
libcurl4-gnutls-dev \
libcairo2-dev \
libxt-dev \
libxml2-dev \
default-jdk \
libssl-dev \
libmariadbclient-dev
LABEL no.rapporteket.cd.enable="true"

# basic R functionality
RUN R -e "install.packages(c('remotes'), repos='https://cloud.r-project.org/')"
WORKDIR /app/R

# install rapRegTemplate app
RUN R -e "remotes::install_github('Rapporteket/rapRegTemplate')"
# hadolint ignore=DL3010
COPY *.tar.gz .

# copy the app to the image
RUN mkdir /root/rapRegTemplate
COPY inst/shinyApps/app1 /root/rapRegTemplate

COPY Rprofile.site /usr/lib/R/etc/
RUN R -e "remotes::install_local(list.files(pattern = \"*.tar.gz\"))" \
&& rm ./*.tar.gz

EXPOSE 3838

CMD ["R", "-e", "shiny::runApp('/root/rapRegTemplate')"]
CMD ["R", "-e", "options(shiny.port = 3838,shiny.host = \"0.0.0.0\"); rapRegTemplate::run_app()"]
5 changes: 5 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Generated by roxygen2: do not edit by hand

export("%>%")
export(app_server)
export(app_ui)
export(getFakeRegData)
export(getRegData)
export(makeHist)
export(run_app)
importFrom(magrittr,"%>%")
Loading

0 comments on commit 9315e63

Please sign in to comment.