Skip to content

Commit

Permalink
Dockerize app for shinyproxy (#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
sdunesme authored Feb 3, 2025
1 parent a84ec96 commit f6a4888
Show file tree
Hide file tree
Showing 7 changed files with 136 additions and 2 deletions.
12 changes: 12 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.RData
.Rhistory
.git
.gitignore
.github
manifest.json
rsconnect/
.Rproj.user
docker-compose.yml
docker-compose.example.yml
.env
.Renviron
52 changes: 52 additions & 0 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Build and publish Docker image

on:
push:
tags: [ 'v*.*.*' ]
workflow_dispatch:

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: |
evs-gis/mapdoapp
ghcr.io/evs-gis/mapdoapp
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Setup Cosign
uses: sigstore/cosign-installer@v3.7.0
with:
cosign-release: 'v2.4.1'

- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
.quarto
restart.txt
docs
docker-compose.yml
5 changes: 4 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
Package: mapdoapp
Title: Application MAPDO
Version: 1.0.0
Version: 2.0.1
Authors@R:
person("Samuel", "Dunesme", , "samuel.dunesme@ens-lyon.fr", role = c("cre", "aut"))
person("Lise", "Vaudor", , "lise.vaudor@ens-lyon.fr", role = c("cre", "aut"))
person("Leo", "Helling", , "jan.helling@ens-lyon.fr", role = c("cre", "aut"))
person("Louis", "Manière", , "louis.maniere@ens-lyon.fr", role = c("cre", "aut"))
Description: Application de description des caractéristiques
morphologiques des réseaux hydrographiques.
Expand Down
53 changes: 53 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
FROM rocker/verse:4.4.1

LABEL org.opencontainers.image.authors="Samuel Dunesme <samuel.dunesme@ens-lyon.fr>"
LABEL org.opencontainers.image.url="https://github.com/evs-gis/mapdoapp"
LABEL org.opencontainers.image.documentation="https://evs-gis.github.io/mapdowebsite/""
LABEL org.opencontainers.image.version="2.0.1"
LABEL org.opencontainers.image.description="Application de description des caractéristiques \
morphologiques des réseaux hydrographiques."
RUN apt-get update && apt-get install -y gdal-bin libcurl4-openssl-dev libgdal-dev libgeos-dev libicu-dev libpng-dev libpq-dev libproj-dev libsqlite3-dev libssl-dev libudunits2-dev libxml2-dev make pandoc zlib1g-dev && rm -rf /var/lib/apt/lists/*
RUN locale-gen fr_FR.UTF-8
RUN mkdir -p /usr/local/lib/R/etc/ /usr/lib/R/etc/
RUN echo "options(repos = c(CRAN = 'https://cran.rstudio.com/'), download.file.method = 'libcurl', Ncpus = 4)" | tee /usr/local/lib/R/etc/Rprofile.site | tee /usr/lib/R/etc/Rprofile.site
RUN R -e 'install.packages("remotes")'
RUN Rscript -e 'remotes::install_version("rlang",upgrade="never", version = "1.1.4")'
RUN Rscript -e 'remotes::install_version("glue",upgrade="never", version = "1.7.0")'
RUN Rscript -e 'remotes::install_version("magrittr",upgrade="never", version = "2.0.3")'
RUN Rscript -e 'remotes::install_version("cachem",upgrade="never", version = "1.1.0")'
RUN Rscript -e 'remotes::install_version("bslib",upgrade="never", version = "0.7.0")'
RUN Rscript -e 'remotes::install_version("htmltools",upgrade="never", version = "0.5.8.1")'
RUN Rscript -e 'remotes::install_version("jsonlite",upgrade="never", version = "1.8.8")'
RUN Rscript -e 'remotes::install_version("tibble",upgrade="never", version = "3.2.1")'
RUN Rscript -e 'remotes::install_version("stringr",upgrade="never", version = "1.5.1")'
RUN Rscript -e 'remotes::install_version("purrr",upgrade="never", version = "1.0.2")'
RUN Rscript -e 'remotes::install_version("dplyr",upgrade="never", version = "1.1.4")'
RUN Rscript -e 'remotes::install_version("RColorBrewer",upgrade="never", version = "1.1-3")'
RUN Rscript -e 'remotes::install_version("shiny",upgrade="never", version = "1.8.1.1")'
RUN Rscript -e 'remotes::install_version("DBI",upgrade="never", version = "1.2.3")'
RUN Rscript -e 'remotes::install_version("tidyr",upgrade="never", version = "1.3.1")'
RUN Rscript -e 'remotes::install_version("httr",upgrade="never", version = "1.4.7")'
RUN Rscript -e 'remotes::install_version("leaflet",upgrade="never", version = "2.2.2")'
RUN Rscript -e 'remotes::install_version("config",upgrade="never", version = "0.3.2")'
RUN Rscript -e 'remotes::install_version("shinyjs",upgrade="never", version = "2.1.0")'
RUN Rscript -e 'remotes::install_version("testthat",upgrade="never", version = "3.2.1.1")'
RUN Rscript -e 'remotes::install_version("spelling",upgrade="never", version = "2.2")'
RUN Rscript -e 'remotes::install_version("waiter",upgrade="never", version = "0.2.5")'
RUN Rscript -e 'remotes::install_version("sparkline",upgrade="never", version = "2.0")'
RUN Rscript -e 'remotes::install_version("shinyWidgets",upgrade="never", version = "0.8.7")'
RUN Rscript -e 'remotes::install_version("sf",upgrade="never", version = "1.0-17")'
RUN Rscript -e 'remotes::install_version("RPostgres",upgrade="never", version = "1.4.7")'
RUN Rscript -e 'remotes::install_version("reactable",upgrade="never", version = "0.4.4")'
RUN Rscript -e 'remotes::install_version("plotly",upgrade="never", version = "4.10.4")'
RUN Rscript -e 'remotes::install_version("leaflet.extras",upgrade="never", version = "2.0.1")'
RUN Rscript -e 'remotes::install_version("golem",upgrade="never", version = "0.5.1")'
RUN Rscript -e 'remotes::install_version("colourpicker",upgrade="never", version = "1.3.0")'
RUN Rscript -e 'remotes::install_version("cicerone",upgrade="never", version = "1.0.4")'
RUN Rscript -e 'remotes::install_version("bsicons",upgrade="never", version = "0.1.2")'
RUN mkdir /app
ADD . /app
WORKDIR /app
RUN R -e 'remotes::install_local(upgrade="never")'
EXPOSE 3838
CMD ["R", "-f", "app.R"]
2 changes: 1 addition & 1 deletion app.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
Sys.setlocale("LC_ALL","fr_FR.UTF-8")

pkgload::load_all(export_all = FALSE,helpers = FALSE,attach_testthat = FALSE)
options( "golem.app.prod" = TRUE)
options("shiny.port" = 3838, "shiny.host" = "0.0.0.0", "golem.app.prod" = TRUE)
mapdoapp::run_app() # add parameters here (if any)
13 changes: 13 additions & 0 deletions docker-compose.example.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
services:
app:
image: gcr.io/evs-gis/mapdoapp:latest
build: .
ports:
- "3838:3838"
environment:
- DBMAPDO_HOST=
- DBMAPDO_PORT=
- DBMAPDO_NAME=
- DBMAPDO_USER=
- DBMAPDO_PASS=
- GEOSERVER=

0 comments on commit f6a4888

Please sign in to comment.