USING IRONSECUREDOC

Docker Build Push Action (How it Works for Developers)

Published January 14, 2025
Share:

What is Docker?

Docker is an open-source powerhouse that makes building, deploying, and managing applications easier by placing them into lightweight, portable containers. The containers package up an application and its dependencies including libraries, configuration files, and so on so that it can even run across environments. This eliminates all compatibility issues, meaning the application will act the same on a developer's laptop as on a server or in the cloud. It simplifies the development, testing, and scaling process by building the tools efficiently, shipping, and running containers, hence managing the resources more simplistically.

Docker Build Push Action (How it Works for Developers): Figure 1 - Docker

What is Docker Image?

Images are the Docker-type blueprints that carry the consistent runtime environments. The developers can utilize ready-to-use images from Docker Hub, a public registry, or create their own Docker images. Tools like Docker Compose and Kubernetes extend Docker's capabilities even more by adding simple orchestrations of multi-container setups or managing complex scaling needs more platforms.

Why use the Docker Build Push Action?

Frictionless Automation

Building and pushing Docker images manually is exposed, error-prone, and time-consuming. Automating these steps ensures predictability and adds hours to the bottom line, especially when the team scales or updates are more frequent.

Frictionless Integration

The Docker Build Push Action works out of the box with GitHub repositories to create workflows around events such as code pushes, pull requests, or a schedule.

Standard Building of Images

Automation ensures that every time Docker images are built, they are the same; hence, reducing errors/discrepancies across multiple environments such as development, staging, and production.

Easy Deployment

With the automated building of Docker images with the build, and their push to the repositories, the deployment can get relatively easy. Tools like Kubernetes or Docker Swarm can be used to pull or build multi-platform images straight from the Docker registry, and hence reduce downtime.

How the Docker Build Push Action Works

The Build and Push Docker action does three core things:

  1. Set Up Docker Login: Container registry authentication to securely push Docker images.
  2. Image Build: Runs Docker build commands using a Dockerfile which contains instructions.
  3. Push to Registry: It pushes the built image to a target container registry.

These steps are defined in a GitHub Actions workflow file (.github/workflows/your-workflow.yml), where you specify triggers, build configurations, and registry credentials.

Implement Docker Build Push Action

1: Prepare Your Repository

  • Add a Dockerfile describing the containerized application.
  • Add any configuration files or scripts required for the build.
# Use Node.js as the base image
FROM node:14
# Set the working directory
WORKDIR /app
# Copy package.json and install dependencies
COPY package.json .
RUN npm install
# Copy the application code
COPY . .
# Expose the application’s port
EXPOSE 3000
# Start the application
CMD ["npm", "start"]
# Use Node.js as the base image
FROM node:14
# Set the working directory
WORKDIR /app
# Copy package.json and install dependencies
COPY package.json .
RUN npm install
# Copy the application code
COPY . .
# Expose the application’s port
EXPOSE 3000
# Start the application
CMD ["npm", "start"]
#Use Node.js as the base image
#Set the working directory
#Copy package.json and install dependencies
#Copy the application code
#Expose the application's port
#Start the application
'INSTANT VB TODO TASK: The following line uses invalid syntax:
'FROM node:14 WORKDIR /app COPY package.json.RUN npm install COPY. . EXPOSE 3000 CMD ["npm", "start"]
VB   C#

2: Add Registry Credentials as GitHub Secrets

To build and push Docker images to a container registry, you need credentials. Add these as GitHub Secrets:

  • Go into your repository settings on GitHub.
  • Go to Secrets and Variables> Actions.

Add the following secrets:

USERNAME: Your Docker Hub username.

PASSWORD: Your Docker Hub access token or password.

For other registries, this is similar but sometimes requires extra credentials, for example, AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY for Amazon ECR.

3: Create GitHub Actions workflow

Add the below line on the YAML workflow file in .github/workflows/docker-build-push.yml.

name: Docker Build and Push
on:
  push:
    branches:
      - main
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      # Step 1: Check out the repository
      - name: Checkout code
        uses: actions/checkout@v3
      # Step 2: Log in to Docker Hub
      - name: Log in to Docker Hub
        uses: docker/login-action@v2
        with:
          username: ${{ secrets.DOCKER_USERNAME }}
          password: ${{ secrets.DOCKER_PASSWORD }}
      # Step 3: Build and push the Docker image
      - name: Build and push
        uses: docker/build-push-action@v4
        with:
          context: .
          push: true
          tags: username/repository:latest
name: Docker Build and Push
on:
  push:
    branches:
      - main
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      # Step 1: Check out the repository
      - name: Checkout code
        uses: actions/checkout@v3
      # Step 2: Log in to Docker Hub
      - name: Log in to Docker Hub
        uses: docker/login-action@v2
        with:
          username: ${{ secrets.DOCKER_USERNAME }}
          password: ${{ secrets.DOCKER_PASSWORD }}
      # Step 3: Build and push the Docker image
      - name: Build and push
        uses: docker/build-push-action@v4
        with:
          context: .
          push: true
          tags: username/repository:latest
Private name:
	  #Step 1: Check out the repository
	  #Step 2: Log in to Docker Hub
Docker Build [and] Push [on]: push: branches: - main jobs: build: runs-[on]: ubuntu-latest steps: - name: Checkout code uses: actions/checkoutv3 - name: Log in [to] Docker Hub uses: docker/login-actionv2 [with]: username: ReadOnly Property $() As
	If True Then
		secrets.DOCKER_USERNAME
	End If
End Property
		  Private password:
		  $
		  If True Then
			  If True Then
				  secrets.DOCKER_PASSWORD
			  End If
		  End If
	  #Step 3: Build and push the Docker image
'INSTANT VB TODO TASK: The following line uses invalid syntax:
'	  - name: Build @and push uses: docker/build-push-action@v4 @with: context: .push: True tags: username/repository:latest
VB   C#

Push to Main: The workflow will trigger every push that occurs to the main branch.

Checkout Code: Utilize the actions/checkout action to check out the repository.

Login to Registry: Authenticate with Docker Hub using the provided secrets.

Build and Push: It runs the Docker Build Push Action that will build the image from the current directory until the context and push it to username/repository: latest.

Commit the workflow file to your repository. With a simple push, the workflow will trigger to build the image and push it into your specified registry.

What is IronSecureDoc?

IronSecureDoc is a newly developed product of Iron Software specifically designed for securing digital documents, mainly PDFs, through quite robust encryption and controls. This will further enable an organization to install advanced encryption protocols like AES-256 so that the said sensitive information cannot be viewed without authorized permission. That means the said document can only be opened by the authorized user because the printing, editing, and copying of it have restrictions along with custom permissions. Also, password protection and digital signings enhance security and integrity in the documents and watermarking.

Docker Build Push Action (How it Works for Developers): Figure 2 - IronSecureDoc: The PDF Security and Compliance Server

IronSecureDoc is developer-friendly and can comfortably house applications via Docker or other programming environments, hence should be able to adapt to many business workflows. For instance, in the health, financial, and legal sectors, confidentiality of the documents means everything. IronSecureDoc combines the features of encryption and control of documents within an organization with ensuring safekeeping that allows for compliance, easy, and safe sharing with a partner or client outside.

How IronSecureDoc Works

IronSecureDoc is given out as a Docker container and provides exposure to the build functionalities by API endpoints which will keep it scalable and uniform. Developers pull a pre-built Docker image of IronSecureDoc from a container registry and include it in their applications.

Document Workflow with IronSecureDoc

  • Create and push the IronSecureDoc container using Docker Build Push Action.
  • Deployment of the same container on a cloud platform like AWS ECS or Kubernetes.
  • Integrate your application to communicate with IronSecureDoc for any document operation.

Install and Run IronSecureDoc

To pull the IronSecureDoc Docker image from the GitHub repository below, at the Command Prompt or in an open terminal window, run the following command.

docker pull ironsoftwareofficial/ironsecuredoc
docker pull ironsoftwareofficial/ironsecuredoc
'INSTANT VB TODO TASK: The following line uses invalid syntax:
'docker pull ironsoftwareofficial/ironsecuredoc
VB   C#

Docker Build Push Action (How it Works for Developers): Figure 3 - Pull Docker Image

After pulling an image from the Docker container, we have another command to start the IronSecureDoc, an operating container.

docker container run --rm -p 8080:8080 -e IronSecureDoc_LicenseKey=<IRONSECUREDOC_LICENSE_KEY> -e ENVIRONMENT=Development -e HTTP_PORTS=8080 ironsoftwareofficial/ironsecuredoc:latest
docker container run --rm -p 8080:8080 -e IronSecureDoc_LicenseKey=<IRONSECUREDOC_LICENSE_KEY> -e ENVIRONMENT=Development -e HTTP_PORTS=8080 ironsoftwareofficial/ironsecuredoc:latest
'INSTANT VB TODO TASK: The following line uses invalid syntax:
'docker container run --rm -p 8080:8080 -e IronSecureDoc_LicenseKey=<IRONSECUREDOC_LICENSE_KEY> -e ENVIRONMENT=Development -e HTTP_PORTS=8080 ironsoftwareofficial/ironsecuredoc:latest
VB   C#

The above Docker run command will create a container instance of the IronSecureDoc.

Using IronSecureDoc

The REST API of IronSecureDoc has been discussed elsewhere, but basically, it allows the user to redact, certify, and encrypt documents out of the box upon installation and firing up Docker. Here is the link to the documentation.

Docker Build Push Action (How it Works for Developers): Figure 4 - REST API

We could also encrypt a document by posting to the IronSecureDoc API like this:

curl -X 'POST' \
  'http://localhost:8080/v1/document-services/pdfs/encrypt?user_password=demo' \
  -H 'accept: */*' \
  -H 'Content-Type: multipart/form-data' \
  -F 'pdf_file=@test.pdf;type=application/pdf'
curl -X 'POST' \
  'http://localhost:8080/v1/document-services/pdfs/encrypt?user_password=demo' \
  -H 'accept: */*' \
  -H 'Content-Type: multipart/form-data' \
  -F 'pdf_file=@test.pdf;type=application/pdf'
'INSTANT VB TODO TASK: The following line uses invalid syntax:
'curl -X 'POST' \ 'http: -H 'accept: */ *' \ -H 'Content-Type: multipart/form-data' \ -F 'pdf_file=@test.pdf;type=application/pdf'
VB   C#

This will route the document automatically into IronSecureDoc, where it will get correctly encrypted.

Conclusion

All starts with Docker Build Push Action and IronSecureDoc. They merge two very powerful tools that unlock the ability to containerize workflows with automated and scalable development being secure. Docker Build Push Action takes care of automated building and deployment in the development process of container images, and IronSecureDoc handles robust document security within those containers. It all comes to streamlined pipelines from developers and reliable performance across environments. Whether you're managing a deployment of applications or secure sensitive documents, these tools in your workflow are about to move you toward modern efficient software development.

IronSecureDoc: where document-specific security features can be added, including file encryption, access controls, and authentication of the authenticity of the document using digital signatures. Together, Docker certificates and IronSecureDoc provide full-cycle security, protecting everything from infrastructure to sensitive data stored. To learn more about the license of IronSecureDoc, visit the licensing page. For information about many of the products from Iron Software, follow this library suite link.

< PREVIOUS
Coolify Docker Compose (How it Works for Developers)
NEXT >
How to Secure PDF API in Docker Using C#

Ready to get started? Version: 2024.10 just released

Free DownloadView Licenses >