Initial commit

This commit is contained in:
2024-11-24 11:32:32 +01:00
commit c3b90db9e6
4 changed files with 75 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
.idea

10
Dockerfile Normal file
View File

@@ -0,0 +1,10 @@
FROM public.ecr.aws/docker/library/node:22-alpine3.20
# Install git for gitea actions and ansible
RUN apk add --no-cache git curl unzip docker-cli-buildx
WORKDIR /usr/src
COPY entrypoint.sh .
CMD ["/usr/src/entrypoint.sh"]

35
action.yml Normal file
View File

@@ -0,0 +1,35 @@
name: Docker build push !
description: A custom docker build push
author: Skydust
# Define your inputs here.
inputs:
imageName:
description: The image name
required: true
imagePrefix:
description: The image prefix
required: false
default: {{ gitea.repositoryUrl }}/${{ gitea.repository_owner }}/
push:
description: Should push the built image
required: false
default: "true"
pullCache:
description: Uses the pull cache
required: false
default: "true"
# Define your outputs here.
outputs:
imageName:
description: The full image name
runs:
using: docker
image: Dockerfile
env:
INPUT_IMAGE_NAME: ${{ inputs.imageName }}
INPUT_IMAGE_PREFIX: ${{ inputs.imagePrefix }}
INPUT_PUSH: ${{ inputs.push }}
INPUT_PULL_CACHE: ${{ inputs.pullCache }}

29
entrypoint.sh Normal file
View File

@@ -0,0 +1,29 @@
#!/bin/sh -l
IMAGE_NAME="$(echo "$INPUT_IMAGE_PREFIX" | sed 's/^https\?:\/\///')$INPUT_IMAGE_NAME"
echo "::notice file=entrypoint.sh,line=7::$IMAGE_NAME"
if [ -z "$INPUT_IMAGE_NAME" ]; then
echo "No image name given."
exit 1
fi;
if [ "$INPUT_PUSH" = "true" ]; then
DOCKER_BUILD_OPTIONS="${DOCKER_BUILD_OPTIONS} --push"
fi
if [ "$INPUT_PULL_CACHE" = "true" ]; then
# shellcheck disable=SC2089
DOCKER_BUILD_OPTIONS="${DOCKER_BUILD_OPTIONS} --cache-from \"$IMAGE_NAME\""
echo "Pulling for cache"
docker pull "$1" || echo "No image found."
fi
echo "Building and pushing !"
# shellcheck disable=SC2090
docker buildx build ${DOCKER_BUILD_OPTIONS} -t "$IMAGE_NAME" --progress plain
echo "imageName=${IMAGE_NAME}" >>"$GITEA_OUTPUT"
exit 0