Skip to content

Commit

Permalink
Merge branch 'hotfix/9_hotfix' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristopherMarais committed Feb 6, 2024
2 parents 38bfdea + 185d9b1 commit 242ff54
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 3 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/docker-image-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Build & Publish Dashboard-dev

on:
push:
branches:
- hotfix/** # Matches any branch with prefix 'hotfix/'
- release/** # Matches any branch with prefix 'release/'

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

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

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: gtmnerr # CHANGE THIS TO BE A SECRET ON GITHUB ###
password: dckr_pat__hEdxbRrtLePYXseurTdnZ7da6M # CHANGE THIS TO BE A SECRET ON GITHUB ###

# Build and push the Docker image to dockerhub
- name: Build and push docker image
uses: docker/build-push-action@v2
with:
context: .
file: ./05_DASHBOARD/Dockerfile-dev
push: true
tags: gtmnerr/dashboard-dev:latest
no-cache: true
build-args: |
BRANCH_NAME=${{ github.ref_name }}
- name: List contents of the app directory
run: docker run --rm gtmnerr/dashboard-dev:latest ls /usr/src/dashboard-development/

# run the docker image to publish to shinyapps.io
- name: Run docker image
# CHANGE ALL VARIABLES TO BE SECRETS ON GITHUB ###
run: >
docker run -e SHINY_ACC_NAME=gtmnerr -e TOKEN=C45D396CDEDC0F87E0415BDDCB10D264 -e SECRET=amOf/66XsI1PtjFXGhEmWaBcuIzlhY6WLBirWL2y gtmnerr/dashboard-dev:latest
3 changes: 3 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ jobs:
file: ./05_DASHBOARD/Dockerfile
push: true
tags: gtmnerr/dashboard:latest
no-cache: true
build-args: |
BRANCH_NAME=${{ github.ref_name }}
# run the docker image to publish to shinyapps.io
- name: Run docker image
Expand Down
10 changes: 8 additions & 2 deletions 05_DASHBOARD/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
FROM rocker/shiny:4.3.2
# Define BRANCH_NAME as an argument
ARG BRANCH_NAME
# You can use the ARG value as an environment variable if needed
ENV BRANCH_NAME=${BRANCH_NAME}
RUN install2.r rsconnect shiny tidyverse bslib leaflet sf
WORKDIR /usr/src/dashboard-development
# Copy the 'app' directory contents into the container at /usr/src/app
COPY ./ /usr/src/dashboard-development
# Copy the 'app' directory contents into the container
COPY ./03_Data_for_app /usr/src/dashboard-development/03_Data_for_app/
COPY ./04_Tests /usr/src/dashboard-development/04_Tests/
COPY ./05_DASHBOARD /usr/src/dashboard-development/05_DASHBOARD/
CMD Rscript /usr/src/dashboard-development/05_DASHBOARD/deploy.R
12 changes: 12 additions & 0 deletions 05_DASHBOARD/Dockerfile-dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM rocker/shiny:4.3.2
# Define BRANCH_NAME as an argument
ARG BRANCH_NAME
# You can use the ARG value as an environment variable if needed
ENV BRANCH_NAME=${BRANCH_NAME}
RUN install2.r rsconnect shiny tidyverse bslib leaflet sf
WORKDIR /usr/src/dashboard-development
# Copy the 'app' directory contents into the container
COPY ./03_Data_for_app /usr/src/dashboard-development/03_Data_for_app/
COPY ./04_Tests /usr/src/dashboard-development/04_Tests/
COPY ./05_DASHBOARD /usr/src/dashboard-development/05_DASHBOARD/
CMD Rscript /usr/src/dashboard-development/05_DASHBOARD/deploy-dev.R
15 changes: 15 additions & 0 deletions 05_DASHBOARD/deploy-dev.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Load the rsconnect package
library(rsconnect)

# Authenticate
rsconnect::setAccountInfo(
name = Sys.getenv("SHINY_ACC_NAME"),
token = Sys.getenv("TOKEN"),
secret = Sys.getenv("SECRET"))

# Deploy
rsconnect::deployApp(
appDir = "./05_DASHBOARD",
appFiles = "app.R",
appName = "Dashboard-dev",
forceUpdate = TRUE)
3 changes: 2 additions & 1 deletion 05_DASHBOARD/deploy.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ rsconnect::setAccountInfo(
rsconnect::deployApp(
appDir = "./05_DASHBOARD",
appFiles = "app.R",
appName = "Dashboard")
appName = "Dashboard",
forceUpdate = TRUE)

0 comments on commit 242ff54

Please sign in to comment.