Update docker-build.yml #27
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker Build and Test | |
# Trigger on push to main branch or on pull requests | |
on: | |
push: | |
branches: [ "main", "dev" ] | |
pull_request: | |
branches: [ "main", "dev" ] | |
jobs: | |
# Build and test Docker image but don't push | |
build-and-test: | |
name: Build and Test Docker Image | |
runs-on: ubuntu-latest | |
timeout-minutes: 120 # Aumentado a 2 horas para dar más tiempo a la compilación | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
# Set up Docker Buildx | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
# Extract metadata (tags, labels) for Docker | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: test/oxicloud | |
tags: | | |
type=ref,event=branch | |
type=ref,event=pr | |
type=sha | |
# Build Docker image but don't push | |
- name: Build Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: false | |
load: true | |
tags: test/oxicloud:test | |
# Caché eliminado para evitar problemas de expiración de token | |
# Run some basic tests against the built image | |
- name: Test Docker image | |
run: | | |
docker run --rm test/oxicloud:test --version || true | |
docker run --rm test/oxicloud:test --help || true | |
# Verify the image structure | |
echo "✅ Checking Docker image layers and size" | |
docker image inspect test/oxicloud:test | |
echo "✅ Docker build and test completed successfully" |