Skip to content

Commit c03fb5e

Browse files
committed
CI build and push image
1 parent 06f588b commit c03fb5e

File tree

1 file changed

+39
-48
lines changed

1 file changed

+39
-48
lines changed

.github/workflows/demo_build_and_deploy.yml

Lines changed: 39 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -26,57 +26,48 @@ jobs:
2626

2727

2828
steps:
29-
# - name: checkout
30-
# uses: actions/checkout@v4
31-
# with:
32-
# submodules: 'false'
29+
- name: checkout
30+
uses: actions/checkout@v4
31+
with:
32+
submodules: 'false'
3333

34-
# # Set up BuildKit Docker container builder to be able to build
35-
# # multi-platform images and export cache
36-
# # https://github.com/docker/setup-buildx-action
37-
# - name: Set up Docker Buildx
38-
# uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
34+
# Set up BuildKit Docker container builder to be able to build
35+
# multi-platform images and export cache
36+
# https://github.com/docker/setup-buildx-action
37+
- name: Set up Docker Buildx
38+
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
3939

40-
# # Login against a Docker registry except on PR
41-
# # https://github.com/docker/login-action
42-
# - name: Log into registry ${{ env.REGISTRY }}
43-
# # if: github.event_name != 'pull_request'
44-
# uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
45-
# with:
46-
# registry: ${{ env.REGISTRY }}
47-
# username: ${{ github.actor }}
48-
# password: ${{ secrets.GITHUB_TOKEN }}
40+
# Login against a Docker registry except on PR
41+
# https://github.com/docker/login-action
42+
- name: Log into registry ${{ env.REGISTRY }}
43+
# if: github.event_name != 'pull_request'
44+
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
45+
with:
46+
registry: ${{ env.REGISTRY }}
47+
username: ${{ github.actor }}
48+
password: ${{ secrets.GITHUB_TOKEN }}
4949

50-
# # Extract metadata (tags, labels) for Docker
51-
# # https://github.com/docker/metadata-action
52-
# - name: Extract Docker metadata
53-
# id: meta
54-
# uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
55-
# with:
56-
# images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
50+
# Extract metadata (tags, labels) for Docker
51+
# https://github.com/docker/metadata-action
52+
- name: Extract Docker metadata
53+
id: meta
54+
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
55+
with:
56+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
5757

58-
# # Build and push Docker image with Buildx
59-
# # https://github.com/docker/build-push-action
60-
# - name: Build and push Docker image
61-
# id: build-and-push
62-
# uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
63-
# with:
64-
# context: demos-docker
65-
# file: demos-docker/Dockerfile
66-
# push: true
67-
# github-token: ${{ secrets.GITHUB_TOKEN }}
68-
# # tags: "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest"
69-
# tags: ${{ steps.meta.outputs.tags }}
70-
# labels: ${{ steps.meta.outputs.labels }}
71-
# cache-from: type=gha
72-
# cache-to: type=gha,mode=max
58+
# Build and push Docker image with Buildx
59+
# https://github.com/docker/build-push-action
60+
- name: Build and push Docker image
61+
id: build-and-push
62+
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
63+
with:
64+
context: demos-docker
65+
file: demos-docker/Dockerfile
66+
push: true
67+
github-token: ${{ secrets.GITHUB_TOKEN }}
68+
tags: "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest"
69+
labels: ${{ steps.meta.outputs.labels }}
70+
cache-from: type=gha
71+
cache-to: type=gha,mode=max
7372

7473

75-
- name: test ssh connection
76-
uses: appleboy/ssh-action@v1
77-
with:
78-
host: ${{ secrets.POPCORN_HOSTS }}
79-
username: ${{ secrets.POPCORN_USER }}
80-
key: ${{ secrets.POPCORN_SSH_PRIV }}
81-
port: ${{ secrets.POPCORN_PORT }}
82-
script: w

0 commit comments

Comments
 (0)