Añadir .gitea/workflows/prueba-imagen.yml
This commit is contained in:
1 parent
b6a292f9c5
commit
afb1ff1980
1 file changed
+52
@@ -0,0 +1,52 @@
|
|||||||
|
name: Prueba de construcción de imagen
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
paths:
|
||||||
|
- .gitea/workflows/prueba-imagen.yml
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
construir:
|
||||||
|
runs-on: gitea-ci
|
||||||
|
timeout-minutes: 15
|
||||||
|
|
||||||
|
container:
|
||||||
|
image: moby/buildkit:v0.34.0-rootless
|
||||||
|
options: >-
|
||||||
|
--user=1000:1000
|
||||||
|
--security-opt seccomp=unconfined
|
||||||
|
--security-opt apparmor=gitea-buildkit-rootless
|
||||||
|
--security-opt systempaths=unconfined
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Construir y exportar imagen
|
||||||
|
shell: sh
|
||||||
|
working-directory: /tmp
|
||||||
|
env:
|
||||||
|
BUILDKITD_FLAGS: --oci-worker-snapshotter=native
|
||||||
|
run: |
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
CONTEXT=$(mktemp -d /tmp/prueba-build.XXXXXX)
|
||||||
|
trap 'rm -rf "$CONTEXT"' EXIT
|
||||||
|
|
||||||
|
cat > "$CONTEXT/Dockerfile" <<'EOF'
|
||||||
|
FROM alpine:3.23
|
||||||
|
RUN printf 'Imagen construida desde Gitea Actions\n' > /prueba.txt \
|
||||||
|
&& test -s /prueba.txt
|
||||||
|
CMD ["cat", "/prueba.txt"]
|
||||||
|
EOF
|
||||||
|
|
||||||
|
buildctl-daemonless.sh build \
|
||||||
|
--frontend dockerfile.v0 \
|
||||||
|
--local context="$CONTEXT" \
|
||||||
|
--local dockerfile="$CONTEXT" \
|
||||||
|
--opt platform=linux/amd64 \
|
||||||
|
--output "type=oci,dest=$CONTEXT/imagen.tar"
|
||||||
|
|
||||||
|
test -s "$CONTEXT/imagen.tar"
|
||||||
|
tar -tf "$CONTEXT/imagen.tar"
|
||||||
|
sha256sum "$CONTEXT/imagen.tar"
|
||||||
|
|
||||||
|
echo "Imagen construida y exportada correctamente"
|
||||||
Reference in new issue
Block a user