main #4

Merged
drunkendog merged 2 commits from main into custom-container-actions 2023-08-28 18:53:40 +01:00
2 changed files with 14 additions and 4 deletions

View File

@ -1,12 +1,14 @@
name: Build Docker Image for Actions name: Build Docker Image for Actions
on: [push] on: [push]
if: github.ref == 'refs/heads/main'
jobs: jobs:
Check-Last-Time: Check-If-Rebuild:
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
env: env:
DEBIAN_FRONTEND: noninteractive DEBIAN_FRONTEND: noninteractive
outputs: outputs:
last-time: ${{ steps.last-time.outputs.last-time }} last-time: ${{ steps.last-time.outputs.last-time }}
dockerfile-changed: ${{ steps.dockerfile-changed.outputs.dockerfile-changed }}
steps: steps:
- name: Install jq - name: Install jq
run: | run: |
@ -19,9 +21,17 @@ jobs:
| xargs -i date --date {} +%s | xargs -i date --date {} +%s
| xargs -i expr $(date +%s) - {} | xargs -i expr $(date +%s) - {}
| xargs -i echo last-time={} >> $GITHUB_OUTPUT | xargs -i echo last-time={} >> $GITHUB_OUTPUT
- name: Check if Dockerfile changed
id: dockerfile-changed
run: |
if ${{ github.event_name == 'pull_request' }}; then
echo dockerfile-changed=$(git diff --name-only -r HEAD^1 HEAD | grep -x actions/Dockerfile | wc -l) >> $GITHUB_OUTPUT
else
echo dockerfile-changed=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }} | grep -x actions/Dockerfile | wc -l) >> $GITHUB_OUTPUT
fi
Build-Image: Build-Image:
needs: [Check-Last-Time] needs: [Check-If-Rebuild]
if: needs.Check-Last-Time.outputs.last-time > 86400 if: needs.Check-If-Rebuild.outputs.last-time > 86400 || needs.Check-If-Rebuild.outputs.dockerfile-changed == 1
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
steps: steps:
- name: Check out repository code - name: Check out repository code

View File

@ -1,4 +1,4 @@
FROM ubuntu:22.04 FROM ubuntu:22.04
ENV DEBIAN_FRONTEND=noninteractive ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update -y && apt-get install -y ca-certificates curl gnupg lsb-release nano wget tmux htop python3 python3-pip git certbot borgbackup jq && rm -rf /var/lib/apt/lists/* RUN apt-get update -y && apt-get install -y ca-certificates curl gnupg lsb-release nano wget tmux htop python3 python3-pip git certbot borgbackup jq nodejs && rm -rf /var/lib/apt/lists/*
CMD ["/bin/bash"] CMD ["/bin/bash"]