Skip to content

Merge pull request #548 from dmunozv04/dockerfile #47

Merge pull request #548 from dmunozv04/dockerfile

Merge pull request #548 from dmunozv04/dockerfile #47

Workflow file for this run

name: Docker CI/CD
# Controls when the workflow will run
on:
push:
branches:
- '*'
tags:
- 'v*'
pull_request:
branches:
- '*'
release:
types: [published]
workflow_dispatch:
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
# Get the repository's code
- name: Checkout
uses: actions/checkout@v4
# Generate docker tags
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: fiware/wirecloud, quay.io/fiware/wirecloud
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
# Get cache and inject it into docker (https://github.com/reproducible-containers/buildkit-cache-dance)
- name: Cache
uses: actions/cache@v4
id: cache
with:
path: |
var-cache-apt
root-cache-pip
key: cache-${{ hashFiles('Dockerfile') }}
- name: inject cache into docker
uses: reproducible-containers/buildkit-cache-dance@v3
with:
cache-map: |
{
"var-cache-apt": "/var/cache/apt",
"root-cache-pip": "/root/.cache/pip"
}
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to Quay.io
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_TOKEN }}
- name: Build amd64 to test
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64
tags: fiware/wirecloud:latest
load: true #Load into docker daemon to test
cache-from: type=gha
- name: Setup python to test
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install dependencies to test
run: |
sudo pip install sh requests
- name: Run tests
run: |
cd docker-platform
sudo python tests.py
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64, linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max