-
-
Notifications
You must be signed in to change notification settings - Fork 29
51 lines (42 loc) · 1.9 KB
/
docker-image.yml
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
48
49
50
51
#..........................................................................................................
# build, push and cache the docker image. I have to adjust the following in case of a different repository:
# - I have to add the 'BUILD_DATE' arg in the Dockerfile
# - I have to create a DOCKER_PASSWORD (use the docker token) in the 'Settings' tab of the repository
# References:
# - https://github.com/mlampros/IceSat2R/blob/master/.github/workflows/docker_image.yml
# - https://github.com/orgs/community/discussions/25768#discussioncomment-3249184
#..........................................................................................................
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
name: docker_img
jobs:
build:
runs-on: ubuntu-latest
steps:
- id: string
uses: ASzc/change-string-case-action@v1
with:
string: ${{ github.event.repository.name }}
- name: Check Out Repo
uses: actions/checkout@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ github.repository_owner }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build and push
uses: docker/build-push-action@v2
with:
context: ./
build-args: BUILD_DATE="$(date -u +'%Y-%m-%dT%H:%M:%SZ')"
file: ./Dockerfile
builder: ${{ steps.buildx.outputs.name }}
push: true
tags: ${{ github.repository_owner }}/${{ steps.string.outputs.lowercase }}:rstudiodev
cache-from: type=registry,ref=${{ github.repository_owner }}/${{ steps.string.outputs.lowercase }}:buildcache
cache-to: type=registry,ref=${{ github.repository_owner }}/${{ steps.string.outputs.lowercase }}:buildcache,mode=max