Skip to content

Commit

Permalink
misc changes
Browse files Browse the repository at this point in the history
- add listen on host var
- rename host and port vars
- expose default port in docker file
- fix compose oopsies
  • Loading branch information
bakerboy448 committed Apr 26, 2024
1 parent ec62d3d commit f0a2b95
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
9 changes: 6 additions & 3 deletions DOCKERFILE
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ ENV PYTHONDONTWRITEBYTECODE=1
# Set Python stdout and stderr streams to be unbuffered
ENV PYTHONUNBUFFERED=1

# Set Flask application port
ENV FLASK_RUN_PORT=4295

# Install system dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends gcc libffi-dev \
Expand All @@ -25,12 +28,12 @@ COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt

# Copy the rest of the application
COPY . .

# Specify non-root user to run the app
RUN useradd -m myuser
USER myuser

# Expose the port the app runs on
EXPOSE 4295

# Command to run the application
CMD ["python", "./autodns.py"]
7 changes: 4 additions & 3 deletions autodns.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,9 @@ def main():
if hasattr(args, 'func'):
args.func(args)
else:
# If no CLI command is provided, run the Flask app # Use the FLASK_RUN_PORT environment variable or default to port 5000
port = int(os.getenv("FLASK_RUN_PORT", "5000"))
app.run(host="0.0.0.0", port=port)
# Run autodns daemon by default
port = int(os.getenv("AUTODNS_PORT", "5000"))
listen_on = os.getenv("AUTODNS_HOST", "0.0.0.0")
app.run(host=listen_on, port=port)
if name == "main":
main()
8 changes: 3 additions & 5 deletions docker-compose.example.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
version: "3.9" # Updated to the latest supported version as of 2024
services:
autodns:
build:
context: .
dockerfile: Dockerfile
image:ghcr.io/bakerboy448/autodns:latest
ports:
- "4295:4295"
volumes:
Expand All @@ -12,5 +9,6 @@ services:
CF_ZONE_ID: "your-zone-id"
CF_API_TOKEN: "your-api-token"
APPRISE_URLS: "your-apprise-urls-separated-by-commas"
FLASK_RUN_PORT: 4295
AUTODNS_PORT: 4295
AUTODNS_HOST: 0.0.0.0 # Any IPv4
restart: unless-stopped

0 comments on commit f0a2b95

Please sign in to comment.