Skip to content

Commit

Permalink
Add tar1090
Browse files Browse the repository at this point in the history
  • Loading branch information
iakat committed Oct 4, 2023
1 parent 9234d92 commit dc191ca
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 0 deletions.
76 changes: 76 additions & 0 deletions .github/workflows/tar1090.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: tar1090

on:
schedule:
- cron: "0 10 * * *"
push:
branches:
- "**"
tags:
- "v*.*.*"
pull_request:
branches:
- "main"

jobs:
tar1090:
runs-on: ubuntu-latest
steps:
- name: Set variables useful for later
id: useful_vars
run: |-
echo "::set-output name=timestamp::$(date +%s)"
echo "::set-output name=short_sha::${GITHUB_SHA::8}"
- name: Checkout
uses: actions/checkout@v3
with:
repository: wiedehopf/tar1090
# we need to get this repo's Dockerfile on top of the repo
- name: Get Dockerfile
run: |
wget https://raw.githubusercontent.com/katlol/containers/main/tar1090/Dockerfile -O Dockerfile
- name: Docker meta
id: docker_meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/${{ github.repository }}/tar1090
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha,prefix=,format=long,event=tag
type=sha
type=raw,value=latest,enable=${{ endsWith(github.ref, github.event.repository.default_branch) }}
type=raw,value=${{ github.ref_name }}-${{ steps.useful_vars.outputs.short_sha }}-${{ steps.useful_vars.outputs.timestamp }},enable=${{ endsWith(github.ref, github.event.repository.default_branch) }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GHCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-tar1090-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-tar1090-buildx-
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache,mode=max
17 changes: 17 additions & 0 deletions tar1090/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM nginx:alpine
WORKDIR /opt/tar1090
COPY html .
COPY nginx.conf /etc/nginx/tar1090.conf
RUN set -ex && \
apk add --virtual=.build-deps git sed && \
mkdir -p /opt/tar1090-db && \
wget -qO- https://github.com/katlol/tar1090-db/releases/latest/download/db.tar | tar -C /opt/tar1090-db -xvf - && \
ln -s /opt/tar1090-db/db /opt/tar1090/db2 && \
sed -i'' "s/INSTANCE\///" /etc/nginx/tar1090.conf && \
sed -i'' "s/\/INSTANCE/\//" /etc/nginx/tar1090.conf && \
sed -i'' 's/\/SERVICE/\/readsb/' /etc/nginx/tar1090.conf && \
sed -i'' 's/SOURCE_DIR\//\/run\/readsb\//' /etc/nginx/tar1090.conf && \
sed -i'' 's/HTMLPATH\//\/opt\/tar1090\//' /etc/nginx/tar1090.conf && \
echo "server {listen 80;listen [::]:80;server_name _;include /etc/nginx/tar1090.conf;}" > /etc/nginx/conf.d/default.conf && \
nginx -t && \
apk del .build-deps

0 comments on commit dc191ca

Please sign in to comment.