Skip to content

Update r-docker-deploy.yaml #10

Update r-docker-deploy.yaml

Update r-docker-deploy.yaml #10

name: Build R Docker Image
on:
push:
branches:
- main
jobs:
build-docker-image:
runs-on: ubuntu-latest
steps:
# Checkout repository
- name: Checkout code
uses: actions/checkout@v3
# Build Docker image
- name: Build Docker image
run: |
docker build -t ghcr.io/dfe-analytical-services/dfe-r-base2:latest .
# Run R setup action inside Docker container
- name: Run R setup action
uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
# Start a container from the image
- name: Run container
run: |
docker run -d --name temp-container ghcr.io/dfe-analytical-services/dfe-r-base2:latest
# Commit the changes to the Docker image
- name: Commit Docker image changes
run: |
docker commit temp-container ghcr.io/dfe-analytical-services/dfe-r-base2:latest
# Authenticate with GitHub Container Registry
- name: Log in to GitHub Container Registry
run: |
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
# Push Docker image to GitHub Container Registry
- name: Push Docker image to GitHub Container Registry
run: |
docker push ghcr.io/dfe-analytical-services/dfe-r-base2:latest
# Clean up by stopping and removing the container
- name: Clean up container
run: |
docker stop temp-container
docker rm temp-container