mirror of
https://github.com/gotenberg/gotenberg.git
synced 2026-08-08 00:22:14 +01:00
ci(build): #540 add AWS Lambda support
This commit is contained in:
1
.env
1
.env
@@ -3,4 +3,5 @@ DOCKER_REGISTRY=gotenberg
|
|||||||
DOCKER_REPOSITORY=gotenberg
|
DOCKER_REPOSITORY=gotenberg
|
||||||
DOCKERFILE=build/Dockerfile
|
DOCKERFILE=build/Dockerfile
|
||||||
DOCKERFILE_CLOUDRUN=build/Dockerfile.cloudrun
|
DOCKERFILE_CLOUDRUN=build/Dockerfile.cloudrun
|
||||||
|
DOCKERFILE_AWS_LAMBDA=build/Dockerfile.aws-lambda
|
||||||
DOCKER_BUILD_CONTEXT='.'
|
DOCKER_BUILD_CONTEXT='.'
|
||||||
|
|||||||
4
.github/actions/build-test-push/action.yml
vendored
4
.github/actions/build-test-push/action.yml
vendored
@@ -34,6 +34,9 @@ outputs:
|
|||||||
tags_cloud_run:
|
tags_cloud_run:
|
||||||
description: Comma separated list of Cloud Run tags (linux/amd64 only)
|
description: Comma separated list of Cloud Run tags (linux/amd64 only)
|
||||||
value: ${{ steps.build.outputs.tags_cloud_run }}
|
value: ${{ steps.build.outputs.tags_cloud_run }}
|
||||||
|
tags_aws_lambda:
|
||||||
|
description: Comma separated list of AWS Lambda tags (linux/amd64 and linux/arm64 only)
|
||||||
|
value: ${{ steps.build.outputs.tags_aws_lambda }}
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: composite
|
using: composite
|
||||||
@@ -87,3 +90,4 @@ runs:
|
|||||||
run: |
|
run: |
|
||||||
echo "tags=${{ steps.build.outputs.tags }}"
|
echo "tags=${{ steps.build.outputs.tags }}"
|
||||||
echo "tags_cloud_run=${{ steps.build.outputs.tags_cloud_run }}"
|
echo "tags_cloud_run=${{ steps.build.outputs.tags_cloud_run }}"
|
||||||
|
echo "tags_aws_lambda=${{ steps.build.outputs.tags_aws_lambda }}"
|
||||||
|
|||||||
51
.github/actions/build-test-push/build.sh
vendored
51
.github/actions/build-test-push/build.sh
vendored
@@ -56,6 +56,7 @@ fi
|
|||||||
# Build tags arrays.
|
# Build tags arrays.
|
||||||
tags=()
|
tags=()
|
||||||
tags_cloud_run=()
|
tags_cloud_run=()
|
||||||
|
tags_aws_lambda=()
|
||||||
|
|
||||||
IFS='/' read -ra arch <<< "$platform"
|
IFS='/' read -ra arch <<< "$platform"
|
||||||
IFS='.' read -ra semver <<< "$version"
|
IFS='.' read -ra semver <<< "$version"
|
||||||
@@ -79,6 +80,13 @@ if [ "${#semver[@]}" -eq 3 ]; then
|
|||||||
tags_cloud_run+=("$DOCKER_REGISTRY/$DOCKER_REPOSITORY:$major.$minor-cloudrun")
|
tags_cloud_run+=("$DOCKER_REGISTRY/$DOCKER_REPOSITORY:$major.$minor-cloudrun")
|
||||||
tags_cloud_run+=("$DOCKER_REGISTRY/$DOCKER_REPOSITORY:$major.$minor.$patch-cloudrun")
|
tags_cloud_run+=("$DOCKER_REGISTRY/$DOCKER_REPOSITORY:$major.$minor.$patch-cloudrun")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "$platform" = "linux/amd64" ] || [ "$platform" = "linux/arm64" ]; then
|
||||||
|
tags_aws_lambda+=("$DOCKER_REGISTRY/$DOCKER_REPOSITORY:latest-aws-lambda-${arch[1]}")
|
||||||
|
tags_aws_lambda+=("$DOCKER_REGISTRY/$DOCKER_REPOSITORY:$major-aws-lambda-${arch[1]}")
|
||||||
|
tags_aws_lambda+=("$DOCKER_REGISTRY/$DOCKER_REPOSITORY:$major.$minor-aws-lambda-${arch[1]}")
|
||||||
|
tags_aws_lambda+=("$DOCKER_REGISTRY/$DOCKER_REPOSITORY:$major.$minor.$patch-aws-lambda-${arch[1]}")
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo
|
echo
|
||||||
echo "Non-semver version detected, fallback to $version"
|
echo "Non-semver version detected, fallback to $version"
|
||||||
@@ -87,10 +95,15 @@ else
|
|||||||
if [ "$platform" = "linux/amd64" ]; then
|
if [ "$platform" = "linux/amd64" ]; then
|
||||||
tags_cloud_run+=("$DOCKER_REGISTRY/$DOCKER_REPOSITORY:$version-cloudrun")
|
tags_cloud_run+=("$DOCKER_REGISTRY/$DOCKER_REPOSITORY:$version-cloudrun")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "$platform" = "linux/amd64" ] || [ "$platform" = "linux/arm64" ]; then
|
||||||
|
tags_aws_lambda+=("$DOCKER_REGISTRY/$DOCKER_REPOSITORY:$version-aws-lambda-${arch[1]}")
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
tags_flags=()
|
tags_flags=()
|
||||||
tags_cloud_run_flags=()
|
tags_cloud_run_flags=()
|
||||||
|
tags_aws_lambda_flags=()
|
||||||
|
|
||||||
echo "Will use the following tags:"
|
echo "Will use the following tags:"
|
||||||
for tag in "${tags[@]}"; do
|
for tag in "${tags[@]}"; do
|
||||||
@@ -101,6 +114,10 @@ for tag in "${tags_cloud_run[@]}"; do
|
|||||||
tags_cloud_run_flags+=("-t" "$tag")
|
tags_cloud_run_flags+=("-t" "$tag")
|
||||||
echo "- $tag"
|
echo "- $tag"
|
||||||
done
|
done
|
||||||
|
for tag in "${tags_aws_lambda[@]}"; do
|
||||||
|
tags_aws_lambda_flags+=("-t" "$tag")
|
||||||
|
echo "- $tag"
|
||||||
|
done
|
||||||
echo
|
echo
|
||||||
|
|
||||||
# Build images.
|
# Build images.
|
||||||
@@ -138,24 +155,30 @@ cmd="docker buildx build \
|
|||||||
"
|
"
|
||||||
run_cmd "$cmd"
|
run_cmd "$cmd"
|
||||||
|
|
||||||
if [ "$platform" != "linux/amd64" ]; then
|
if [ "$platform" = "linux/amd64" ]; then
|
||||||
echo "⚠️ Skip Cloud Run variant(s)"
|
cmd="docker build \
|
||||||
echo "✅ Done!"
|
--build-arg DOCKER_REGISTRY=$DOCKER_REGISTRY \
|
||||||
echo "tags=$(join "," "${tags[@]}")" >> "$GITHUB_OUTPUT"
|
--build-arg DOCKER_REPOSITORY=$DOCKER_REPOSITORY \
|
||||||
echo "tags_cloud_run=$(join "," "${tags_cloud_run[@]}")" >> "$GITHUB_OUTPUT"
|
--build-arg GOTENBERG_VERSION=$version \
|
||||||
exit 0
|
${tags_cloud_run_flags[*]} \
|
||||||
|
-f $DOCKERFILE_CLOUDRUN $DOCKER_BUILD_CONTEXT
|
||||||
|
"
|
||||||
|
run_cmd "$cmd"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cmd="docker build \
|
if [ "$platform" = "linux/amd64" ] || [ "$platform" = "linux/arm64" ]; then
|
||||||
--build-arg DOCKER_REGISTRY=$DOCKER_REGISTRY \
|
cmd="docker build \
|
||||||
--build-arg DOCKER_REPOSITORY=$DOCKER_REPOSITORY \
|
--build-arg DOCKER_REGISTRY=$DOCKER_REGISTRY \
|
||||||
--build-arg GOTENBERG_VERSION=$version \
|
--build-arg DOCKER_REPOSITORY=$DOCKER_REPOSITORY \
|
||||||
${tags_cloud_run_flags[*]} \
|
--build-arg GOTENBERG_VERSION=$version \
|
||||||
-f $DOCKERFILE_CLOUDRUN $DOCKER_BUILD_CONTEXT
|
${tags_aws_lambda_flags[*]} \
|
||||||
"
|
-f $DOCKERFILE_AWS_LAMBDA $DOCKER_BUILD_CONTEXT
|
||||||
run_cmd "$cmd"
|
"
|
||||||
|
run_cmd "$cmd"
|
||||||
|
fi
|
||||||
|
|
||||||
echo "✅ Done!"
|
echo "✅ Done!"
|
||||||
echo "tags=$(join "," "${tags[@]}")" >> "$GITHUB_OUTPUT"
|
echo "tags=$(join "," "${tags[@]}")" >> "$GITHUB_OUTPUT"
|
||||||
echo "tags_cloud_run=$(join "," "${tags_cloud_run[@]}")" >> "$GITHUB_OUTPUT"
|
echo "tags_cloud_run=$(join "," "${tags_cloud_run[@]}")" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "tags_aws_lambda=$(join "," "${tags_aws_lambda[@]}")" >> "$GITHUB_OUTPUT"
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
1
.github/actions/clean/clean.sh
vendored
1
.github/actions/clean/clean.sh
vendored
@@ -40,6 +40,7 @@ IFS=',' read -ra tags_to_delete <<< "$tags"
|
|||||||
if [ -n "$snapshot_version" ]; then
|
if [ -n "$snapshot_version" ]; then
|
||||||
tags_to_delete+=("$DOCKER_REGISTRY/snapshot:$snapshot_version")
|
tags_to_delete+=("$DOCKER_REGISTRY/snapshot:$snapshot_version")
|
||||||
tags_to_delete+=("$DOCKER_REGISTRY/snapshot:$snapshot_version-cloudrun")
|
tags_to_delete+=("$DOCKER_REGISTRY/snapshot:$snapshot_version-cloudrun")
|
||||||
|
tags_to_delete+=("$DOCKER_REGISTRY/snapshot:$snapshot_version-aws-lambda")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Will delete the following tag(s):"
|
echo "Will delete the following tag(s):"
|
||||||
|
|||||||
10
.github/workflows/continuous-delivery.yml
vendored
10
.github/workflows/continuous-delivery.yml
vendored
@@ -108,9 +108,17 @@ jobs:
|
|||||||
tags: "${{ needs.release_amd64.outputs.tags }},${{ needs.release_386.outputs.tags }},${{ needs.release_arm64.outputs.tags }},${{ needs.release_arm_v7.outputs.tags }}"
|
tags: "${{ needs.release_amd64.outputs.tags }},${{ needs.release_386.outputs.tags }},${{ needs.release_arm64.outputs.tags }},${{ needs.release_arm_v7.outputs.tags }}"
|
||||||
alternate_registry: thecodingmachine
|
alternate_registry: thecodingmachine
|
||||||
|
|
||||||
|
- name: Merge AWS Lambda
|
||||||
|
uses: ./.github/actions/merge
|
||||||
|
with:
|
||||||
|
docker_hub_username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
docker_hub_password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
tags: "${{ needs.release_amd64.outputs.tags_aws_lambda }},${{ needs.release_arm64.outputs.tags_aws_lambda }}"
|
||||||
|
alternate_registry: thecodingmachine
|
||||||
|
|
||||||
- name: Clean
|
- name: Clean
|
||||||
uses: ./.github/actions/clean
|
uses: ./.github/actions/clean
|
||||||
with:
|
with:
|
||||||
docker_hub_username: ${{ secrets.DOCKERHUB_USERNAME }}
|
docker_hub_username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
docker_hub_password: ${{ secrets.DOCKERHUB_TOKEN }}
|
docker_hub_password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
tags: "${{ needs.release_amd64.outputs.tags }},${{ needs.release_386.outputs.tags }},${{ needs.release_arm64.outputs.tags }},${{ needs.release_arm_v7.outputs.tags }}"
|
tags: "${{ needs.release_amd64.outputs.tags }},${{ needs.release_386.outputs.tags }},${{ needs.release_arm64.outputs.tags }},${{ needs.release_arm_v7.outputs.tags }},${{ needs.release_amd64.outputs.tags_aws_lambda }},${{ needs.release_arm64.outputs.tags_aws_lambda }}"
|
||||||
|
|||||||
19
.github/workflows/continuous-integration.yml
vendored
19
.github/workflows/continuous-integration.yml
vendored
@@ -202,12 +202,19 @@ jobs:
|
|||||||
docker_hub_password: ${{ secrets.DOCKERHUB_TOKEN }}
|
docker_hub_password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
tags: "${{ needs.snapshot_amd64.outputs.tags }},${{ needs.snapshot_386.outputs.tags }},${{ needs.snapshot_arm64.outputs.tags }},${{ needs.snapshot_arm_v7.outputs.tags }}"
|
tags: "${{ needs.snapshot_amd64.outputs.tags }},${{ needs.snapshot_386.outputs.tags }},${{ needs.snapshot_arm64.outputs.tags }},${{ needs.snapshot_arm_v7.outputs.tags }}"
|
||||||
|
|
||||||
|
- name: Merge AWS Lambda
|
||||||
|
uses: ./.github/actions/merge
|
||||||
|
with:
|
||||||
|
docker_hub_username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
docker_hub_password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
tags: "${{ needs.snapshot_amd64.outputs.tags_aws_lambda }},${{ needs.snapshot_arm64.outputs.tags_aws_lambda }}"
|
||||||
|
|
||||||
- name: Clean
|
- name: Clean
|
||||||
uses: ./.github/actions/clean
|
uses: ./.github/actions/clean
|
||||||
with:
|
with:
|
||||||
docker_hub_username: ${{ secrets.DOCKERHUB_USERNAME }}
|
docker_hub_username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
docker_hub_password: ${{ secrets.DOCKERHUB_TOKEN }}
|
docker_hub_password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
tags: "${{ needs.snapshot_amd64.outputs.tags }},${{ needs.snapshot_386.outputs.tags }},${{ needs.snapshot_arm64.outputs.tags }},${{ needs.snapshot_arm_v7.outputs.tags }}"
|
tags: "${{ needs.snapshot_amd64.outputs.tags }},${{ needs.snapshot_386.outputs.tags }},${{ needs.snapshot_arm64.outputs.tags }},${{ needs.snapshot_arm_v7.outputs.tags }},${{ needs.snapshot_amd64.outputs.tags_aws_lambda }},${{ needs.snapshot_arm64.outputs.tags_aws_lambda }}"
|
||||||
|
|
||||||
edge_amd64:
|
edge_amd64:
|
||||||
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
||||||
@@ -317,9 +324,17 @@ jobs:
|
|||||||
tags: "${{ needs.edge_amd64.outputs.tags }},${{ needs.edge_386.outputs.tags }},${{ needs.edge_arm64.outputs.tags }},${{ needs.edge_arm_v7.outputs.tags }}"
|
tags: "${{ needs.edge_amd64.outputs.tags }},${{ needs.edge_386.outputs.tags }},${{ needs.edge_arm64.outputs.tags }},${{ needs.edge_arm_v7.outputs.tags }}"
|
||||||
alternate_registry: thecodingmachine
|
alternate_registry: thecodingmachine
|
||||||
|
|
||||||
|
- name: Merge AWS Lambda
|
||||||
|
uses: ./.github/actions/merge
|
||||||
|
with:
|
||||||
|
docker_hub_username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
docker_hub_password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
tags: "${{ needs.edge_amd64.outputs.tags_aws_lambda }},${{ needs.edge_arm64.outputs.tags_aws_lambda }}"
|
||||||
|
alternate_registry: thecodingmachine
|
||||||
|
|
||||||
- name: Clean
|
- name: Clean
|
||||||
uses: ./.github/actions/clean
|
uses: ./.github/actions/clean
|
||||||
with:
|
with:
|
||||||
docker_hub_username: ${{ secrets.DOCKERHUB_USERNAME }}
|
docker_hub_username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
docker_hub_password: ${{ secrets.DOCKERHUB_TOKEN }}
|
docker_hub_password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
tags: "${{ needs.edge_amd64.outputs.tags }},${{ needs.edge_386.outputs.tags }},${{ needs.edge_arm64.outputs.tags }},${{ needs.edge_arm_v7.outputs.tags }}"
|
tags: "${{ needs.edge_amd64.outputs.tags }},${{ needs.edge_386.outputs.tags }},${{ needs.edge_arm64.outputs.tags }},${{ needs.edge_arm_v7.outputs.tags }},${{ needs.edge_amd64.outputs.tags_aws_lambda }},${{ needs.edge_arm64.outputs.tags_aws_lambda }}"
|
||||||
|
|||||||
Reference in New Issue
Block a user