Skip to content

Commit e01952c

Browse files
authored
Merge pull request #255 from Luke-Roy-IBM/github-action-2
Add new GitHub Action Workflows for Blogpost
2 parents b680aa8 + 56b975c commit e01952c

File tree

6 files changed

+122
-2
lines changed

6 files changed

+122
-2
lines changed

github-action-workflows/README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Source Code for the IBM Cloud Code Engine: Deploying Apps, Jobs and Functions using GitHub Actions Blog post
22

3-
This folder contains the source code used in the [IBM Cloud Code Engine: Deploying Apps, Jobs and Functions using GitHub Actions](https://community.ibm.com/community/user/blogs/luke-roy/2024/02/12/ibm-cloud-code-engine-deploying-apps-jobs-and-func) Blog Post.
3+
This folder contains the source code used in the [IBM Cloud Code Engine: Deploying Apps, Jobs and Functions using GitHub Actions](https://community.ibm.com/community/user/blogs/luke-roy/2024/02/12/ibm-cloud-code-engine-deploying-apps-jobs-and-func) and the [IBM Cloud Code Engine GitHub Action: Getting into the Cloud just got a lot easier!](https://community.ibm.com/community/user/blogs/luke-roy/2025/11/24/ibm-cloud-code-engine-github-action-easier) Blog Posts
44

5-
- [App](github-action-workflows/my-ce-app)
5+
- [App,Build](github-action-workflows/my-ce-app)
6+
- [Docker App](github-action-workflows/my-docker-app)
7+
- [Image App](github-action-workflows/my-img-app)
68
- [Python Function](github-action-workflows/my-ce-py-func)
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Build and Push to ICR
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
app:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Check out code
13+
uses: actions/checkout@v3
14+
15+
- name: Build and Push to ICR
16+
id: build-step
17+
uses: ibm/code-engine-github-action@v1
18+
with:
19+
api-key: ${{ secrets.IBM_IAM_API_KEY }}
20+
region: 'eu-de'
21+
project: 'MY-PROJECT'
22+
component: 'build'
23+
name: 'my-ce-app'
24+
image: private.de.icr.io/my-namespace/my-image:latest
25+
registry-secret: ce-auto-icr-private-eu-de
26+
build-source: './my-ce-app'
27+
- name: Get image with digest
28+
run: |
29+
echo "Image with digest: ${{ steps.build-step.outputs.image-with-digest }}"
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM quay.io/projectquay/golang:1.24 AS build-env
2+
3+
WORKDIR /go/src/app
4+
5+
COPY main.go main.go
6+
7+
RUN CGO_ENABLED=0 go build -o /go/bin/app main.go
8+
9+
FROM gcr.io/distroless/static-debian12
10+
11+
EXPOSE 3000
12+
13+
COPY --from=build-env /go/bin/app /
14+
15+
ENTRYPOINT ["/app"]
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Deploy App to Code Engine using Dockerfile build-strategy
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
jobs:
10+
11+
deploy-app:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Check out code
15+
uses: actions/checkout@v3
16+
17+
- name: Deploy App to Code Engine using Dockerfile build-strategy
18+
uses: IBM/code-engine-github-action@v1
19+
with:
20+
api-key: ${{ secrets.IBM_IAM_API_KEY }}
21+
resource-group: 'Default'
22+
region: 'eu-de'
23+
project: 'MY-PROJECT'
24+
component: 'app'
25+
build-strategy: 'dockerfile'
26+
port: 3000
27+
name: 'my-docker-app'
28+
build-source: './my-docker-app'
29+
cpu: 1
30+
memory: 4G
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
"net/http"
6+
"time"
7+
)
8+
9+
func greet(w http.ResponseWriter, r *http.Request) {
10+
fmt.Fprintf(w, "Hello World! %s", time.Now())
11+
}
12+
13+
func main() {
14+
http.HandleFunc("/", greet)
15+
http.ListenAndServe(":3000", nil)
16+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Deploy Application to Code Engine using existing container image
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
jobs:
10+
11+
deploy-app:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Check out code
15+
uses: actions/checkout@v3
16+
17+
- name: Deploy Application to Code Engine using existing container image
18+
uses: IBM/code-engine-github-action@v1
19+
with:
20+
api-key: ${{ secrets.IBM_IAM_API_KEY }}
21+
resource-group: 'Default'
22+
region: 'eu-de'
23+
project: 'MY-PROJECT'
24+
component: 'app'
25+
name: 'my-img-app'
26+
image: icr.io/codeengine/helloworld:latest
27+
cpu: 1
28+
memory: 4G

0 commit comments

Comments
 (0)