Skip to content

Commit b535fe4

Browse files
committed
Update Actions WF
1 parent a66fd95 commit b535fe4

File tree

10 files changed

+648
-225
lines changed

10 files changed

+648
-225
lines changed

.build.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
ELASTICMS_WEBSITE_SKELETON_VERSION=4.3.0
2-
ELASTICMS_WEBSITE_SKELETON_DOCKER_IMAGE_NAME=docker.io/elasticms/website-skeleton
2+
DOCKER_IMAGE_NAME=docker.io/elasticms/website-skeleton

.github/auto-merge.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
- match:
2+
dependency_type: all
3+
update_type: "semver:minor"

.github/containerscan/allowedlist.yml

Lines changed: 0 additions & 14 deletions
This file was deleted.

.github/workflows/auto-merge.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Dependabot Auto Merge
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
auto-merge:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v3
11+
- uses: ahmadnassri/action-dependabot-auto-merge@v2
12+
with:
13+
target: minor
14+
github-token: ${{ secrets.DEPENDABOT_AUTOMERGE_TOKEN }}

.github/workflows/ci.yml

Lines changed: 0 additions & 206 deletions
This file was deleted.

.github/workflows/docker-build.yml

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
name: Docker Build
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
pull_request:
8+
9+
jobs:
10+
11+
build-docker-images:
12+
13+
runs-on: ubuntu-20.04
14+
15+
steps:
16+
- uses: actions/checkout@v3
17+
18+
- name: Fill GitHub Environment Variables
19+
uses: FranzDiebold/github-env-vars-action@v2
20+
21+
- name: Fill PHP Version Environment Variable
22+
uses: c-py/action-dotenv-to-setenv@v4
23+
with:
24+
env-file: .build.env
25+
26+
- name: Prepare Workflow Environment
27+
id: prep
28+
run: |
29+
echo "docker-image-name=${DOCKER_IMAGE_NAME}" >> $GITHUB_OUTPUT
30+
echo "docker-image-name-dev=${DOCKER_IMAGE_NAME}-dev" >> $GITHUB_OUTPUT
31+
echo "build-date=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
32+
33+
- name: Fill Docker Image metadata
34+
id: meta
35+
uses: docker/metadata-action@v4
36+
with:
37+
github-token: ${{ secrets.GITHUB_TOKEN }}
38+
images: "${{ steps.prep.outputs.docker-image-name }}"
39+
tags: |
40+
type=raw,value=rc
41+
42+
- name: Fill Docker Image metadata (Dev)
43+
id: meta-dev
44+
uses: docker/metadata-action@v4
45+
with:
46+
github-token: ${{ secrets.GITHUB_TOKEN }}
47+
images: "${{ steps.prep.outputs.docker-image-name-dev }}"
48+
tags: |
49+
type=raw,value=rc
50+
51+
- name: Set up Docker Buildx
52+
id: buildx
53+
uses: docker/setup-buildx-action@v2
54+
55+
- name: Cache Docker layers
56+
uses: actions/cache@v3
57+
with:
58+
path: /tmp/.buildx-cache
59+
key: ${{ runner.os }}-buildx-${{ github.sha }}
60+
restore-keys: |
61+
${{ runner.os }}-buildx-
62+
63+
- name: Build Docker Image
64+
id: build
65+
uses: docker/build-push-action@v3
66+
with:
67+
builder: ${{ steps.buildx.outputs.name }}
68+
context: .
69+
file: Dockerfile
70+
target: emsch-prod
71+
build-args: |
72+
VERSION_ARG=${{ env.ELASTICMS_WEBSITE_SKELETON_VERSION }}
73+
RELEASE_ARG=${{ env.CI_RUN_ID }}
74+
VCS_REF_ARG=${{ env.CI_SHA }}
75+
BUILD_DATE_ARG=${{ steps.prep.outputs.build-date }}
76+
push: false
77+
load: true
78+
tags: ${{ steps.meta.outputs.tags }}
79+
labels: ${{ steps.meta.outputs.labels }}
80+
outputs: type=docker,dest=/tmp/myimage.tar
81+
82+
- name: Build Docker Image (Dev)
83+
id: build-dev
84+
uses: docker/build-push-action@v3
85+
with:
86+
builder: ${{ steps.buildx.outputs.name }}
87+
context: .
88+
file: Dockerfile
89+
target: emsch-dev
90+
build-args: |
91+
VERSION_ARG=${{ env.ELASTICMS_WEBSITE_SKELETON_VERSION }}
92+
RELEASE_ARG=${{ env.CI_RUN_ID }}
93+
VCS_REF_ARG=${{ env.CI_SHA }}
94+
BUILD_DATE_ARG=${{ steps.prep.outputs.build-date }}
95+
push: false
96+
load: true
97+
tags: ${{ steps.meta-dev.outputs.tags }}
98+
labels: ${{ steps.meta-dev.outputs.labels }}
99+
outputs: type=docker,dest=/tmp/myimage-dev.tar
100+
101+
- name: Squash Docker Image
102+
id: squash
103+
run: |
104+
pip install docker-squash
105+
cat /tmp/myimage.tar | docker load
106+
cat /tmp/myimage-dev.tar | docker load
107+
docker-squash --verbose --message "Build and Squashed in GitHub Action" \
108+
--tag ${{ steps.prep.outputs.docker-image-name }}:rc \
109+
--output-path /tmp/myimage.tar \
110+
${{ steps.prep.outputs.docker-image-name }}:rc
111+
docker-squash --verbose --message "Build and Squashed in GitHub Action" \
112+
--tag ${{ steps.prep.outputs.docker-image-name-dev }}:rc \
113+
--output-path /tmp/myimage-dev.tar \
114+
${{ steps.prep.outputs.docker-image-name-dev }}:rc
115+
cat /tmp/myimage.tar | docker load
116+
cat /tmp/myimage-dev.tar | docker load
117+
118+
- name: Check Docker Image
119+
run: |
120+
docker image inspect ${{ steps.prep.outputs.docker-image-name }}:rc
121+
docker image inspect ${{ steps.prep.outputs.docker-image-name-dev }}:rc
122+
docker history ${{ steps.prep.outputs.docker-image-name }}:rc
123+
docker history ${{ steps.prep.outputs.docker-image-name-dev }}:rc

0 commit comments

Comments
 (0)