Skip to content

Commit 3b5dec1

Browse files
committed
Add initial Dockerfile and github build actions.
1 parent 1b381b5 commit 3b5dec1

4 files changed

Lines changed: 66 additions & 0 deletions

File tree

.github/dependabot.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "docker"
4+
directory: "/"
5+
schedule:
6+
interval: "daily"

.github/workflows/build.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Build and Push Docker Images
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
17+
- name: Set up QEMU
18+
uses: docker/setup-qemu-action@v3
19+
20+
- name: Set up Docker Buildx
21+
uses: docker/setup-buildx-action@v3
22+
23+
- name: Log in to GitHub Container Registry
24+
uses: docker/login-action@v3
25+
with:
26+
registry: ghcr.io
27+
username: ${{ github.actor }}
28+
password: ${{ secrets.GITHUB_TOKEN }}
29+
30+
- name: Build and push the tinyproxy image
31+
uses: docker/build-push-action@v6
32+
with:
33+
context: .
34+
platforms: linux/amd64,linux/arm64
35+
push: true
36+
tags: ghcr.io/querateam/docker-tinyproxy:latest

Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
FROM alpine:latest
2+
WORKDIR /app
3+
RUN apk add --no-cache tinyproxy curl
4+
COPY run.sh /app/run.sh
5+
EXPOSE 8888
6+
ENTRYPOINT ["/bin/sh", "/app/run.sh"]

run.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/sh
2+
3+
CONFIG_FILE="/etc/tinyproxy/tinyproxy.conf"
4+
FILTER_FILE="/etc/tinyproxy/filter"
5+
6+
sed -i "s|^Allow |#Allow |" "$CONFIG_FILE"
7+
8+
if [ ! -z $ALLOWED_HOSTS ]; then
9+
sed -i "s|^#Filter .*|Filter \"${FILTER_FILE}\"|" "$CONFIG_FILE"
10+
sed -i "s|^#FilterDefaultDeny .*|FilterDefaultDeny Yes|" "$CONFIG_FILE"
11+
12+
touch $FILTER_FILE
13+
for host in $(echo $ALLOWED_HOSTS | tr ',' '\n'); do
14+
echo "$host" >> "$FILTER_FILE"
15+
done
16+
fi
17+
18+
exec tinyproxy -d -c $CONFIG_FILE

0 commit comments

Comments
 (0)