Skip to content

Commit 416ee39

Browse files
github4demof5shemyakin
authored andcommitted
update terraform scripts
1 parent 0128f62 commit 416ee39

26 files changed

Lines changed: 917 additions & 799 deletions

.dockerignore

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Git
2+
.git
3+
.gitignore
4+
.github
5+
6+
# Documentation
7+
README.md
8+
README.rst
9+
*.md
10+
*.rst
11+
12+
# Terraform
13+
terraform/
14+
15+
# Build artifacts
16+
.DS_Store
17+
*.log
18+
*.tmp
19+
20+
# IDE
21+
.vscode/
22+
.idea/
23+
24+
# Assets (images not needed for Docker builds)
25+
assets/
26+
27+
# Helm charts (unless specifically needed)
28+
helm/
29+
30+
# Other configs not needed in container
31+
Makefile
32+
LICENSE
33+
ves_ha-services-ce_aws-ha-vk8s.yaml
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
name: Build and Push Docker Images
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
paths:
7+
- 'docker/**'
8+
- 'nginx/**'
9+
- '.github/workflows/docker-build-push.yml'
10+
tags:
11+
- 'v*'
12+
workflow_dispatch:
13+
14+
env:
15+
REGISTRY: ghcr.io
16+
IMAGE_NAME: ${{ github.repository }}
17+
18+
jobs:
19+
build-and-push:
20+
runs-on: ubuntu-latest
21+
permissions:
22+
contents: read
23+
packages: write
24+
25+
strategy:
26+
matrix:
27+
include:
28+
- dockerfile: docker/Dockerfile.migrate.nonroot
29+
image-name: migrate-nonroot
30+
context: .
31+
- dockerfile: docker/Dockerfile.openrestry
32+
image-name: openresty-base
33+
context: .
34+
- dockerfile: docker/Dockerfile.openresty.nonroot
35+
image-name: openresty-nonroot
36+
context: .
37+
38+
steps:
39+
- name: Maximize build space
40+
uses: easimon/maximize-build-space@master
41+
with:
42+
root-reserve-mb: 1024
43+
swap-size-mb: 2048
44+
remove-dotnet: 'true'
45+
remove-android: 'true'
46+
remove-haskell: 'true'
47+
remove-codeql: 'true'
48+
remove-docker-images: 'true'
49+
50+
- name: Checkout repository
51+
uses: actions/checkout@v4
52+
53+
- name: Set up Docker Buildx
54+
id: buildx
55+
uses: docker/setup-buildx-action@v3
56+
with:
57+
driver-opts: |
58+
image=moby/buildkit:buildx-stable-1
59+
network=host
60+
61+
- name: Log in to Container Registry
62+
uses: docker/login-action@v3
63+
with:
64+
registry: ${{ env.REGISTRY }}
65+
username: ${{ github.actor }}
66+
password: ${{ secrets.GITHUB_TOKEN }}
67+
68+
- name: Extract metadata
69+
id: meta
70+
uses: docker/metadata-action@v5
71+
with:
72+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/${{ matrix.image-name }}
73+
tags: |
74+
type=ref,event=tag
75+
type=raw,value=latest,enable={{is_default_branch}}
76+
77+
- name: Build and push Docker image
78+
uses: docker/build-push-action@v5
79+
with:
80+
context: ${{ matrix.context }}
81+
file: ${{ matrix.dockerfile }}
82+
push: true
83+
tags: ${{ steps.meta.outputs.tags }}
84+
labels: ${{ steps.meta.outputs.labels }}
85+
platforms: linux/amd64
86+
cache-from: type=gha
87+
cache-to: type=gha,mode=max
88+
build-args: |
89+
BUILDKIT_INLINE_CACHE=1
90+
builder: ${{ steps.buildx.outputs.name }}
91+
shm-size: 2g
92+
93+
build-summary:
94+
needs: build-and-push
95+
runs-on: ubuntu-latest
96+
if: always()
97+
steps:
98+
- name: Build Summary
99+
run: |
100+
echo "## Docker Build Summary" >> $GITHUB_STEP_SUMMARY
101+
echo "Built and pushed the following images:" >> $GITHUB_STEP_SUMMARY
102+
echo "- migrate-nonroot" >> $GITHUB_STEP_SUMMARY
103+
echo "- openresty-base" >> $GITHUB_STEP_SUMMARY
104+
echo "- openresty-nonroot" >> $GITHUB_STEP_SUMMARY
105+
echo "" >> $GITHUB_STEP_SUMMARY
106+
echo "Images are available at: ghcr.io/${{ github.repository }}" >> $GITHUB_STEP_SUMMARY

Makefile

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,9 @@
11
.PHONY: default, secrets, docker-migrate, docker-nginx, docker, xc-deploy-bd, xc-deploy-nginx, deploy, delete
22

3-
DOCKER_SECRET ?= interestingstorage-secret
4-
DOCKER_REGISTRY ?= interestingstorage
3+
DOCKER_REGISTRY ?= ghcr.io/f5devcentral/xchaawsdemoguide/
54
DOCKER_REPOSITORY_URI ?= $(DOCKER_REGISTRY)/
65

76

8-
secrets:
9-
KUBECONFIG=./ves_ha-services-ce_aws-ha-vk8s.yaml kubectl delete secret $(DOCKER_SECRET) --ignore-not-found
10-
KUBECONFIG=./ves_ha-services-ce_aws-ha-vk8s.yaml kubectl create secret docker-registry $(DOCKER_SECRET) \
11-
--docker-server=$(DOCKER_REGISTRY_SERVER) \
12-
--docker-username=$(DOCKER_USER) \
13-
--docker-password=$(DOCKER_PASS)
14-
15-
167
docker-migrate:
178
docker buildx build --no-cache \
189
--platform=linux/amd64 \
@@ -21,8 +12,8 @@ docker-migrate:
2112
-t migrate \
2213
-f ./docker/Dockerfile.migrate.nonroot \
2314
.
24-
docker tag migrate $(DOCKER_REPOSITORY_URI)migrate:latest
25-
docker push $(DOCKER_REPOSITORY_URI)migrate:latest
15+
docker tag migrate $(DOCKER_REPOSITORY_URI)migrate-nonroot:latest
16+
docker push $(DOCKER_REPOSITORY_URI)migrate-nonroot:latest
2617

2718

2819
docker-nginx:
@@ -40,10 +31,10 @@ docker-nginx:
4031
-t openrestypg-nonroot \
4132
-f ./docker/Dockerfile.openresty.nonroot \
4233
.
43-
docker tag openrestypg $(DOCKER_REPOSITORY_URI)openrestypg:latest
44-
docker push $(DOCKER_REPOSITORY_URI)openrestypg:latest
45-
docker tag openrestypg-nonroot $(DOCKER_REPOSITORY_URI)openrestypg-nonroot:latest
46-
docker push $(DOCKER_REPOSITORY_URI)openrestypg-nonroot:latest
34+
docker tag openrestypg $(DOCKER_REPOSITORY_URI)openresty-base:latest
35+
docker push $(DOCKER_REPOSITORY_URI)openresty-base:latest
36+
docker tag openrestypg-nonroot $(DOCKER_REPOSITORY_URI)openresty-nonroot:latest
37+
docker push $(DOCKER_REPOSITORY_URI)openresty-nonroot:latest
4738

4839

4940
docker: docker-migrate, docker-nginx

0 commit comments

Comments
 (0)