diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 2ae9dce..f436070 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -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: @@ -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 }} @@ -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 '--------------------' \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index b257f60..7f772f0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 @@ -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 \ No newline at end of file +# The base image already contains a command to start PHP and Nginx, so no need to redefine CMD or ENTRYPOINT