-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (38 loc) · 1.24 KB
/
r-docker-deploy.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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-base: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-base: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-base:latest
# Push Docker image to DockerHub
- name: Push Docker image to DockerHub
run: |
docker push ghcr.io/dfe-analytical-services/dfe-r-base:latest
# Clean up by stopping and removing the container
- name: Clean up container
run: |
docker stop temp-container
docker rm temp-container