Development Environment #1149
This file contains 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: Development Environment | |
on: | |
schedule: | |
- cron: '0 0 * * *' | |
push: | |
branches: | |
- main | |
paths: | |
- '.github/workflows/devenv.yml' | |
- 'devenv/**' | |
pull_request: | |
paths: | |
- '.github/workflows/devenv.yml' | |
- 'devenv/**' | |
workflow_dispatch: | |
jobs: | |
docker-build: | |
name: Docker Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Determine if we should push changes and which tags to use | |
run: | | |
if [ -n "${{ secrets.DOCKER_USERNAME }}" ] && [ -n "${{ secrets.DOCKER_TOKEN }}" ] && [ "${{ github.event_name }}" != "pull_request" ] ; then | |
echo "publish=true" >> $GITHUB_ENV | |
else | |
echo "publish=false" >> $GITHUB_ENV | |
fi | |
- name: Setup QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Setup Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Docker Hub Login | |
if: env.publish == 'true' | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_TOKEN }} | |
- name: Prepare Cache | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-devenv | |
- name: Docker Build | |
uses: docker/build-push-action@v5 | |
with: | |
file: devenv/Dockerfile | |
context: devenv | |
platforms: linux/amd64,linux/arm/v7,linux/arm64 | |
push: ${{ env.publish }} | |
tags: netdata/devenv:latest | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache-new | |
- name: Cleanup Cache | |
run: | | |
rm -rf /tmp/.buildx-cache | |
mv /tmp/.buildx-cache-new /tmp/.buildx-cache |