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

Commit

Permalink
feat: adds docker build + public workflow for tutorials image (#7)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Gowiem authored Jun 7, 2021
1 parent 45f2f49 commit 6ab328e
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 56 deletions.
6 changes: 3 additions & 3 deletions 02-atmos/.dockerignore → .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

# Things that could be checked into Git but need not be in the Docker image
.git
.editorconfig
Expand All @@ -11,6 +12,7 @@ aws-assumed-role/

# Compiled and auto-generated files
**/nohup.out
**/.terraform/*
**/*.tfstate
**/*.tfstate.*
**/planfile
Expand All @@ -21,7 +23,6 @@ aws-assumed-role/
**/*.terraform.tfvars.json
**/*.terraform.auto.tfvars.json
**/*.helmfile.vars.yaml
**/vendir.lock.yml

# Module directory
**/.terraform/
Expand All @@ -32,7 +33,6 @@ aws-assumed-role/
# Draft or auto-saved version
# Note that the leading "**/" appears necessary for Docker even if not for Git
**/*.draft.*
**/*.draft
**/*.orig
**/*.bak
**/*~
Expand All @@ -41,4 +41,4 @@ aws-assumed-role/
**/.DS_Store
**/.CFUserTextEncoding
**/.Trash/
**/$RECYCLE.BIN/
**/$RECYCLE.BIN/
51 changes: 51 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: "docker"
on:
pull_request:
types: [opened, synchronize, reopened]
release:
types:
# "released" excludes pre-releases
# "published" is either a release or a pre-release
- published
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout source code at current commit
uses: actions/checkout@v2

# Based off of Geodesic docker workflow:
# https://github.com/cloudposse/geodesic/blob/master/.github/workflows/docker.yml
- name: Prepare tags for Docker image
id: prepare
run: |
echo ::set-output name=publish::${{ (github.event_name == 'release' && github.event.action == 'published') || (github.event.pull_request.head.repo.full_name == github.repository) }}
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/}
fi
# By default, we tag our image with the short sha on all PR pushes
TAGS="${{ github.repository }}:sha-${GITHUB_SHA:0:7}"
# If this is a tagged release, then we tag w/ the semver tag + latest
if [[ -n $VERSION ]]; then
TAGS="$TAGS,${{ github.repository }}:${VERSION},${{ github.repository }}:latest"
fi
printf "Tagging with %s\n" "${TAGS}"
echo "::set-output name=tags::${TAGS}"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
if: steps.prepare.outputs.publish == 'true'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: "Build and push docker image to DockerHub"
id: docker_build
uses: docker/build-push-action@v2
with:
push: ${{ steps.prepare.outputs.publish == 'true' }}
tags: ${{ steps.prepare.outputs.tags }}
file: ./Dockerfile
27 changes: 0 additions & 27 deletions 02-atmos/Dockerfile

This file was deleted.

26 changes: 0 additions & 26 deletions 02-atmos/Makefile

This file was deleted.

0 comments on commit 6ab328e

Please sign in to comment.