Coder Social home page Coder Social logo

mlycore / publish-docker-github-action Goto Github PK

View Code? Open in Web Editor NEW

This project forked from elgohr/publish-docker-github-action

0.0 2.0 1.0 1.01 MB

A Github Action which uses the Git branch as the Docker tag for pushing

License: MIT License

Dockerfile 3.18% Shell 96.82%

publish-docker-github-action's Introduction

Publishes docker containers

Actions Status Actions Status Actions Status

This Action for Docker uses the Git branch as the Docker tag for building and pushing the container. Hereby the master-branch is published as the latest-tag.

Usage

Example pipeline

name: Publish Docker
on: [push]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@master
    - name: Publish to Registry
      uses: elgohr/Publish-Docker-Github-Action@master
      with:
        name: myDocker/repository
        username: ${{ secrets.DOCKER_USERNAME }}
        password: ${{ secrets.DOCKER_PASSWORD }}

Mandatory Arguments

name is the name of the image you would like to push
username the login username for the registry
password the login password for the registry

If you would like to publish the image to AWS ECR, please have a look at https://github.com/elgohr/ecr-login-action

Outputs

tag is the tag, which was pushed
snapshot-tag is the tag that is generated by the snapshot-option and pushed

Optional Arguments

registry

Use registry for pushing to a custom registry

with:
  name: myDocker/repository
  username: ${{ secrets.DOCKER_USERNAME }}
  password: ${{ secrets.DOCKER_PASSWORD }}
  registry: docker.pkg.github.com

snapshot

Use snapshot to push an additional image, which is tagged with
{YEAR}{MONTH}{DAY}{HOUR}{MINUTE}{SECOND}{first 6 digits of the git sha}.
The date was inserted to prevent new builds with external dependencies override older builds with the same sha. When you would like to think about versioning images, this might be useful.

with:
  name: myDocker/repository
  username: ${{ secrets.DOCKER_USERNAME }}
  password: ${{ secrets.DOCKER_PASSWORD }}
  snapshot: true

dockerfile

Use dockerfile when you would like to explicitly build a Dockerfile.
This might be useful when you have multiple DockerImages.

with:
  name: myDocker/repository
  username: ${{ secrets.DOCKER_USERNAME }}
  password: ${{ secrets.DOCKER_PASSWORD }}
  dockerfile: MyDockerFileName

workdir

Use workdir when you would like to change the directory for building.

with:
  name: myDocker/repository
  username: ${{ secrets.DOCKER_USERNAME }}
  password: ${{ secrets.DOCKER_PASSWORD }}
  workdir: mySubDirectory

buildargs

Use buildargs when you want to pass a list of environment variables as build-args. Identifiers are separated by comma.
All buildargs will be masked, so that they don't appear in the logs.

- name: Publish to Registry
  uses: elgohr/Publish-Docker-Github-Action@master
  env:
    MY_FIRST: variableContent
    MY_SECOND: variableContent
  with:
    name: myDocker/repository
    username: ${{ secrets.DOCKER_USERNAME }}
    password: ${{ secrets.DOCKER_PASSWORD }}
    buildargs: MY_FIRST,MY_SECOND

cache

Use cache when you have big images, that you would only like to build partially (changed layers).

CAUTION: This will cache the non changed parts forever. If you use this option, make sure that these parts will be updated by another job!

with:
  name: myDocker/repository
  username: ${{ secrets.DOCKER_USERNAME }}
  password: ${{ secrets.DOCKER_PASSWORD }}
  cache: true

publish-docker-github-action's People

Contributors

elgohr avatar maxwell92 avatar mlycore avatar renovate-bot avatar

Watchers

James Cloos avatar  avatar

Forkers

xuyun-io

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.