Skip to content

Commit 73bdf15

Browse files
author
Leah Wasser
authored
add ci build - actions (#87)
* add ci build * fix step names
1 parent 4f7e6db commit 73bdf15

File tree

3 files changed

+66
-0
lines changed

3 files changed

+66
-0
lines changed

.github/workflows/build-image.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# This build will only build the image on any branch (besides main) where there is a push
2+
name: Build Docker Image
3+
4+
on:
5+
push:
6+
branches:
7+
- '*'
8+
- '!main'
9+
10+
jobs:
11+
build-image:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v2
16+
17+
- name: Login to DockerHub
18+
uses: docker/login-action@v1
19+
with:
20+
username: ${{ secrets.DOCKER_HUB_USERNAME }}
21+
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
22+
23+
- name: Build Image
24+
id: docker_build
25+
uses: docker/build-push-action@v2
26+
with:
27+
context: ./
28+
file: ./Dockerfile
29+
push: false
30+
tags: earthlab/r-python-eds-lessons-env:latest
31+
32+
- name: Image digest
33+
run: echo ${{ steps.docker_build.outputs.digest }}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# This build will build and push the image to docker hub upon a commit to the
2+
# main branch only
3+
name: Push to Docker Hub from Main Branch
4+
5+
on:
6+
push:
7+
branches: main
8+
9+
jobs:
10+
build-push-image:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v2
15+
16+
- name: Login to DockerHub
17+
uses: docker/login-action@v1
18+
with:
19+
username: ${{ secrets.DOCKER_HUB_USERNAME }}
20+
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
21+
22+
- name: Build and push image
23+
id: docker_build
24+
uses: docker/build-push-action@v2
25+
with:
26+
context: ./
27+
file: ./Dockerfile
28+
push: true
29+
tags: earthlab/r-python-eds-lessons-env:latest
30+
31+
- name: Image digest
32+
run: echo ${{ steps.docker_build.outputs.digest }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
.DS_Store
33
.nbgrader.log
44
3.6
5+
.ipynb_checkpoints/

0 commit comments

Comments
 (0)