Skip to content

Commit

Permalink
pushing image build to private ACR and public Docker Hub
Browse files Browse the repository at this point in the history
  • Loading branch information
henrybravo committed Jun 22, 2024
1 parent dcb2562 commit e2fd911
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 5 deletions.
55 changes: 51 additions & 4 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
name: Build and Push to ACR

on:
push:
branches:
- 'main'
name: Build and Push to ACR

jobs:
build-and-push:
build-and-push-to-acr:
runs-on: ubuntu-latest
defaults:
run:
Expand All @@ -14,7 +15,7 @@ jobs:
- name: 'Checkout GitHub Action'
uses: actions/checkout@v4

- name: 'Build and push image'
- name: 'Build and push image to ACR'
uses: azure/docker-login@v1
with:
login-server: ${{ secrets.REGISTRY_LOGIN_SERVER }}
Expand All @@ -25,4 +26,50 @@ jobs:
docker tag ${{ secrets.REGISTRY_LOGIN_SERVER }}/ssl-checker-webapp:${{ github.sha }} ${{ secrets.REGISTRY_LOGIN_SERVER }}/ssl-checker-webapp:latest
docker push ${{ secrets.REGISTRY_LOGIN_SERVER }}/ssl-checker-webapp:${{ github.sha }}
docker push ${{ secrets.REGISTRY_LOGIN_SERVER }}/ssl-checker-webapp:latest
docker inspect ${{ secrets.REGISTRY_LOGIN_SERVER }}/ssl-checker-webapp:latest
echo '--------------------'
docker inspect --format '
ID: {{.Id}}
RepoTags: {{.RepoTags}}
RepoDigests: {{.RepoDigests}}
Created: {{.Created}}
Author: {{.Author}}
Architecture: {{.Architecture}}
OS: {{.Os}}
Size: {{.Size}}
VirtualSize: {{.VirtualSize}}
Metadata: {{.Metadata}}
' ${{ secrets.REGISTRY_LOGIN_SERVER }}/ssl-checker-webapp:latest
echo '--------------------'
build-and-push-to-dockerhub:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: 'Checkout GitHub Action'
uses: actions/checkout@v4

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- run: |
docker build . -t ${{ secrets.DOCKERHUB_USERNAME }}/ssl-checker-webapp:${{ github.sha }}
docker tag ${{ secrets.DOCKERHUB_USERNAME }}/ssl-checker-webapp:${{ github.sha }} ${{ secrets.DOCKERHUB_USERNAME }}/ssl-checker-webapp:latest
docker push ${{ secrets.DOCKERHUB_USERNAME }}/ssl-checker-webapp:${{ github.sha }}
docker push ${{ secrets.DOCKERHUB_USERNAME }}/ssl-checker-webapp:latest
echo '--------------------'
docker inspect --format '
ID: {{.Id}}
RepoTags: {{.RepoTags}}
RepoDigests: {{.RepoDigests}}
Created: {{.Created}}
Author: {{.Author}}
Architecture: {{.Architecture}}
OS: {{.Os}}
Size: {{.Size}}
VirtualSize: {{.VirtualSize}}
Metadata: {{.Metadata}}
' ${{ secrets.DOCKERHUB_USERNAME }}/ssl-checker-webapp:latest
echo '--------------------'
11 changes: 10 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
# Use the specified base image
FROM webdevops/php-nginx-dev:8.2-alpine

LABEL org.opencontainers.image.title="ssl-checker-webapp" \
org.opencontainers.image.description="webapp to check the ssl certificate of a web domain" \
org.opencontainers.image.authors="Henry Bravo" \
org.opencontainers.image.url="https://hub.docker.com/r/henrybravo/ssl-checker-webapp/" \
org.opencontainers.image.documentation="https://github.com/henrybravo/ssl-check/README.md" \
org.opencontainers.image.vendor="Henry Bravo" \
org.opencontainers.image.licenses="MIT" \
org.opencontainers.image.source="https://github.com/henrybravo/ssl-check.git"

# Set the working directory inside the container
WORKDIR /var/www

Expand All @@ -13,4 +22,4 @@ COPY ./docker/nginx.conf /opt/docker/etc/nginx/vhost.conf
# Expose port 80
EXPOSE 80

# The base image already contains a command to start PHP and Nginx, so no need to redefine CMD or ENTRYPOINT
# The base image already contains a command to start PHP and Nginx, so no need to redefine CMD or ENTRYPOINT

0 comments on commit e2fd911

Please sign in to comment.