Skip to content

Instantly share code, notes, and snippets.

@Lewiscowles1986
Created April 7, 2020 16:20
Show Gist options
  • Save Lewiscowles1986/30614146b7f71858faf39bbb17db8c6b to your computer and use it in GitHub Desktop.
Save Lewiscowles1986/30614146b7f71858faf39bbb17db8c6b to your computer and use it in GitHub Desktop.
Build and push to dockerhub
name: Docker Image CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Login to dockerhub
run: |
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
- name: Build the docker image
run: docker build . --file Dockerfile --tag cd2team/mailhog:build
- name: Tag and push
docker tag cd2team/mailhog:build cd2team/mailhog:latest
docker tag cd2team/mailhog:latest cd2team/mailhog:$(date +%s)
docker push cd2team/mailhog:$(date +%s)
docker push cd2team/mailhog:latest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment