Initial commit
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
.idea
|
||||||
10
Dockerfile
Normal file
10
Dockerfile
Normal 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
35
action.yml
Normal 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
29
entrypoint.sh
Normal 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
|
||||||
Reference in New Issue
Block a user