GithubHelp home page GithubHelp logo

gitea-docker-build-and-push-version's Introduction

# Build and Push Docker Image Action

This GitHub Action builds and pushes a Docker image to a Docker registry. It uses Docker to build the image from a specified context directory, tags the image with a version and the latest tag, and pushes both tags to the Docker registry.

## Inputs

### `username`

**Required** The username for the Docker registry.

### `password`

**Required** The password for the Docker registry.

### `path`

**Optional** The path to the Docker context directory. Default is `.`.

### `registry`

**Required** The Docker registry URL.

### `owner`

**Required** The owner of the Docker repository.

## Example Usage

```yaml
name: Build and Push Docker Image

on:
  push:
    branches:
      - main

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout repository
        uses: actions/checkout@v2

      - name: Build and Push Docker Image
        uses: Punga78/gitea-docker-build-and-push-version
        with:
          username: ${{ secrets.DOCKER_USERNAME }}
          password: ${{ secrets.DOCKER_PASSWORD }}
          registry: 'gitea.com'
          owner: 'Punga78'
          path: '.'

Details

This action performs the following steps:

  1. Retrieves the input parameters.
  2. Reads the package.json and optionally build-info.json from the specified context path.
  3. Constructs the Docker image name and tags.
  4. Builds the Docker image using docker buildx build.
  5. Tags the image with both the version and latest tags.
  6. Pushes both tags to the Docker registry.

If the build-info.json file does not exist, the build number defaults to 0.

Note

Ensure that you have the required secrets DOCKER_USERNAME and DOCKER_PASSWORD set in your GitHub repository settings. These will be used to authenticate with the Docker registry.

License

This project is licensed under the MIT License - see the LICENSE file for details.

gitea-docker-build-and-push-version's People

Watchers

 avatar

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.