-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
2,858 additions
and
22 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
source("renv/activate.R") |
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 |
---|---|---|
|
@@ -6,6 +6,14 @@ on: | |
- 'main' | ||
tags: | ||
- "v*" | ||
pull_request: | ||
branches: | ||
- 'main' | ||
|
||
env: | ||
CACHE_IMAGE: ghcr.io/r-geoflow/geoflow-shiny-cache | ||
DOCKER_BUILDKIT: 1 | ||
RENV_PATHS_ROOT: ~/.cache/R/renv | ||
|
||
jobs: | ||
docker: | ||
|
@@ -25,14 +33,7 @@ jobs: | |
type=ref,event=branch | ||
type=ref,event=pr | ||
type=semver,pattern={{version}} | ||
labels: | | ||
org.opencontainers.image.url=https://github.com/r-geoflow/geoflow-shiny | ||
org.opencontainers.image.source=https://github.com/r-geoflow/geoflow-shiny | ||
org.opencontainers.image.title=geoflow-shiny | ||
org.opencontainers.image.description=A A shiny app to manage geoflow configurations | ||
org.opencontainers.image.vendor=Emmanuel Blondel | ||
org.opencontainers.image.author=Emmanuel Blondel | ||
org.opencontainers.image.authors=Emmanuel Blondel <[email protected]> | ||
- name: Login to image repository | ||
if: github.ref_type == 'tag' | ||
uses: docker/login-action@v3 | ||
|
@@ -41,11 +42,37 @@ jobs: | |
username: ${{ github.actor }} | ||
password: ${{ secrets.GHCR_TOKEN }} | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v5 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
with: | ||
driver-opts: image=moby/buildkit:master,network=host | ||
|
||
- name: Cache Docker layers | ||
uses: actions/cache@v3 | ||
with: | ||
context: . | ||
file: Dockerfile | ||
push: ${{ github.ref_type == 'tag' }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
path: /tmp/.buildx-cache | ||
key: ${{ runner.os }}-buildx-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-buildx- | ||
- name: Build Docker image | ||
run: | | ||
docker buildx build \ | ||
--cache-from type=registry,ref=$CACHE_IMAGE:latest \ | ||
--cache-to type=registry,ref=$CACHE_IMAGE:latest,mode=max \ | ||
--tag ghcr.io/r-geoflow/geoflow-shiny:latest \ | ||
--build-arg RENV_PATHS_ROOT=${{ env.RENV_PATHS_ROOT }} \ | ||
--output type=docker,dest=/tmp/docker-image.tar \ | ||
- name: Load Docker image | ||
if: github.ref_type == 'tag' | ||
run: | | ||
docker load -i /tmp/docker-image.tar | ||
- name: Conditional push Docker image | ||
if: github.ref_type == 'tag' | ||
run: | | ||
TAG_NAME=$(basename ${GITHUB_REF}) | ||
docker tag ghcr.io/r-geoflow/geoflow-shiny:latest ghcr.io/r-geoflow/geoflow-shiny:${TAG_NAME} | ||
docker push ghcr.io/r-geoflow/geoflow-shiny:latest | ||
docker push ghcr.io/r-geoflow/geoflow-shiny:${TAG_NAME} |
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,7 +1,13 @@ | ||
FROM rocker/r-ver:4.2.0 | ||
FROM rocker/shiny:4.3.0 | ||
|
||
MAINTAINER Emmanuel Blondel "[email protected]" | ||
|
||
LABEL org.opencontainers.image.title=geoflow-shiny | ||
LABEL org.opencontainers.image.url=https://github.com/r-geoflow/geoflow-shiny | ||
LABEL org.opencontainers.image.source=https://github.com/r-geoflow/geoflow-shiny | ||
LABEL org.opencontainers.image.description=A shiny app to configure and run geoflows | ||
LABEL org.opencontainers.image.authors=Emmanuel Blondel <[email protected]> | ||
|
||
# system libraries of general use | ||
RUN apt-get update && apt-get install -y \ | ||
sudo \ | ||
|
@@ -37,13 +43,33 @@ RUN /rocker_scripts/install_geospatial.sh | |
|
||
# install R core package dependencies | ||
RUN install2.r --error --skipinstalled --ncpus -1 httpuv | ||
RUN R -e "install.packages(c('remotes','jsonlite','yaml'), repos='https://cran.r-project.org/')" | ||
# clone app | ||
RUN git -C /root/ clone https://github.com/eblondel/geoflow-shiny.git && echo "OK!" | ||
RUN ln -s /root/geoflow-shiny /srv/geoflow-shiny | ||
# install R app package dependencies | ||
RUN R -e "source('./srv/geoflow-shiny/install.R')" | ||
|
||
#working directory | ||
WORKDIR /srv/geoflow-shiny | ||
|
||
# Set environment variables for renv cache, see doc https://docs.docker.com/build/cache/backends/ | ||
ARG RENV_PATHS_ROOT | ||
|
||
# Make a directory in the container | ||
RUN mkdir -p ${RENV_PATHS_ROOT} | ||
|
||
#copy renv configuration | ||
RUN R -e "install.packages(c('renv'), repos='https://cran.r-project.org/')" | ||
COPY renv.lock renv.lock | ||
COPY .Rprofile .Rprofile | ||
COPY renv/activate.R renv/activate.R | ||
COPY renv/settings.json renv/settings.json | ||
|
||
# Set renv cache location: change default location of cache to project folder | ||
# see documentation for Multi-stage builds => https://cran.r-project.org/web/packages/renv/vignettes/docker.html | ||
RUN mkdir renv/.cache | ||
ENV RENV_PATHS_CACHE=renv/.cache | ||
|
||
# Restore the R environment | ||
RUN R -e "renv::restore()" | ||
|
||
#copy app | ||
COPY . /srv/dcf-shiny | ||
#etc dirs (for config) | ||
RUN mkdir -p /etc/geoflow-shiny/ | ||
|
||
|
Oops, something went wrong.