Skip to content
This repository was archived by the owner on Jun 19, 2024. It is now read-only.

Commit 6ab328e

Browse files
authored
feat: adds docker build + public workflow for tutorials image (#7)
chore: removes atmos docker image + Makefile fix: attempts to fix tags output chore: adds some debugging code fix: adds newline to address set-output on one line chore: cleans up logic + adds comments
1 parent 45f2f49 commit 6ab328e

File tree

4 files changed

+54
-56
lines changed

4 files changed

+54
-56
lines changed

02-atmos/.dockerignore .dockerignore

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
# Things that could be checked into Git but need not be in the Docker image
23
.git
34
.editorconfig
@@ -11,6 +12,7 @@ aws-assumed-role/
1112

1213
# Compiled and auto-generated files
1314
**/nohup.out
15+
**/.terraform/*
1416
**/*.tfstate
1517
**/*.tfstate.*
1618
**/planfile
@@ -21,7 +23,6 @@ aws-assumed-role/
2123
**/*.terraform.tfvars.json
2224
**/*.terraform.auto.tfvars.json
2325
**/*.helmfile.vars.yaml
24-
**/vendir.lock.yml
2526

2627
# Module directory
2728
**/.terraform/
@@ -32,7 +33,6 @@ aws-assumed-role/
3233
# Draft or auto-saved version
3334
# Note that the leading "**/" appears necessary for Docker even if not for Git
3435
**/*.draft.*
35-
**/*.draft
3636
**/*.orig
3737
**/*.bak
3838
**/*~
@@ -41,4 +41,4 @@ aws-assumed-role/
4141
**/.DS_Store
4242
**/.CFUserTextEncoding
4343
**/.Trash/
44-
**/$RECYCLE.BIN/
44+
**/$RECYCLE.BIN/

.github/workflows/docker.yml

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: "docker"
2+
on:
3+
pull_request:
4+
types: [opened, synchronize, reopened]
5+
release:
6+
types:
7+
# "released" excludes pre-releases
8+
# "published" is either a release or a pre-release
9+
- published
10+
jobs:
11+
build-and-push:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout source code at current commit
15+
uses: actions/checkout@v2
16+
17+
# Based off of Geodesic docker workflow:
18+
# https://github.com/cloudposse/geodesic/blob/master/.github/workflows/docker.yml
19+
- name: Prepare tags for Docker image
20+
id: prepare
21+
run: |
22+
echo ::set-output name=publish::${{ (github.event_name == 'release' && github.event.action == 'published') || (github.event.pull_request.head.repo.full_name == github.repository) }}
23+
if [[ $GITHUB_REF == refs/tags/* ]]; then
24+
VERSION=${GITHUB_REF#refs/tags/}
25+
fi
26+
27+
# By default, we tag our image with the short sha on all PR pushes
28+
TAGS="${{ github.repository }}:sha-${GITHUB_SHA:0:7}"
29+
30+
# If this is a tagged release, then we tag w/ the semver tag + latest
31+
if [[ -n $VERSION ]]; then
32+
TAGS="$TAGS,${{ github.repository }}:${VERSION},${{ github.repository }}:latest"
33+
fi
34+
35+
printf "Tagging with %s\n" "${TAGS}"
36+
echo "::set-output name=tags::${TAGS}"
37+
- name: Set up Docker Buildx
38+
uses: docker/setup-buildx-action@v1
39+
- name: Login to DockerHub
40+
if: steps.prepare.outputs.publish == 'true'
41+
uses: docker/login-action@v1
42+
with:
43+
username: ${{ secrets.DOCKERHUB_USERNAME }}
44+
password: ${{ secrets.DOCKERHUB_PASSWORD }}
45+
- name: "Build and push docker image to DockerHub"
46+
id: docker_build
47+
uses: docker/build-push-action@v2
48+
with:
49+
push: ${{ steps.prepare.outputs.publish == 'true' }}
50+
tags: ${{ steps.prepare.outputs.tags }}
51+
file: ./Dockerfile

02-atmos/Dockerfile

-27
This file was deleted.

02-atmos/Makefile

-26
This file was deleted.

0 commit comments

Comments
 (0)