Skip to content

Commit 9c7ebd4

Browse files
author
Agent Zero
committed
feat: Add Docker support and GitHub Packages workflow
1 parent fff3185 commit 9c7ebd4

File tree

2 files changed

+76
-0
lines changed

2 files changed

+76
-0
lines changed

.github/workflows/docker.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Docker
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
tags: [ 'v*' ]
7+
pull_request:
8+
branches: [ main ]
9+
10+
env:
11+
REGISTRY: ghcr.io
12+
IMAGE_NAME: ${{ github.repository }}
13+
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: read
19+
packages: write
20+
id-token: write
21+
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@v4
25+
26+
- name: Set up Docker Buildx
27+
uses: docker/setup-buildx-action@v3
28+
29+
- name: Log into registry ${{ env.REGISTRY }}
30+
if: github.event_name != 'pull_request'
31+
uses: docker/login-action@v3
32+
with:
33+
registry: ${{ env.REGISTRY }}
34+
username: ${{ github.actor }}
35+
password: ${{ secrets.GITHUB_TOKEN }}
36+
37+
- name: Extract Docker metadata
38+
id: meta
39+
uses: docker/metadata-action@v5
40+
with:
41+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
42+
tags: |
43+
type=ref,event=branch
44+
type=semver,pattern={{version}}
45+
type=semver,pattern={{major}}.{{minor}}
46+
type=semver,pattern={{major}}
47+
type=sha
48+
49+
- name: Build and push Docker image
50+
id: build-and-push
51+
uses: docker/build-push-action@v5
52+
with:
53+
context: .
54+
push: ${{ github.event_name != 'pull_request' }}
55+
tags: ${{ steps.meta.outputs.tags }}
56+
labels: ${{ steps.meta.outputs.labels }}
57+
cache-from: type=gha
58+
cache-to: type=gha,mode=max

Dockerfile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM python:3.11-slim
2+
3+
LABEL org.opencontainers.image.source="https://github.com/SHAdd0WTAka/LocalportManager"
4+
LABEL org.opencontainers.image.description="Zero-dependency local reverse proxy"
5+
LABEL org.opencontainers.image.licenses="MIT"
6+
7+
WORKDIR /app
8+
9+
COPY localportmanager.py .
10+
COPY README.md .
11+
COPY LICENSE .
12+
13+
RUN chmod +x localportmanager.py
14+
15+
EXPOSE 1355
16+
17+
ENTRYPOINT ["python", "/app/localportmanager.py"]
18+
CMD ["proxy"]

0 commit comments

Comments
 (0)