Browse Source

update docker build with version, add changelog

pull/5/head 0.4.0
Trent Larson 8 months ago
parent
commit
400d9e6eb0
  1. 18
      CHANGELOG.md
  2. 10
      Dockerfile
  3. 4
      README.md
  4. 5
      app.py

18
CHANGELOG.md

@ -0,0 +1,18 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.2.0] - 2024-03-31
### Added
- Different times for users to receive notifications
- Ping endpoint
### Changed
- Notification loop runs every 5 minutes.
## [0.1.0]
- First release with subscriptions and daily notifications.

10
Dockerfile

@ -1,11 +1,10 @@
# Use an official Python runtime as a parent image
FROM python:3.8-alpine3.18 as builder
FROM python:alpine3.19 as builder
RUN apk update && apk upgrade
RUN apk add --no-cache --virtual .build-deps build-base git
RUN apk add --upgrade --no-cache bash sqlite libffi-dev tzdata
ENV TZ America/New_York
ENV PYTHONUNBUFFERED 1
# Set the working directory in the container to /app
@ -25,7 +24,10 @@ RUN pip install --no-cache-dir -r requirements.txt
RUN apk del .build-deps
# ---- Production Stage ----
FROM python:3.8-alpine3.18 as production
FROM python:alpine3.19 as production
ARG PUSH_SERVER_VERSION
ENV PUSH_SERVER_VERSION=${PUSH_SERVER_VERSION}
# Create a user to run our application
RUN adduser -D myuser -u 1000
@ -41,5 +43,5 @@ RUN chown -R myuser:myuser /app
USER myuser
# Start gunicorn with the appropriate options
# Without "2>&1" the gunicorn internal logging shows in 'docker logs' but doesn't go to stdout like our 'printf' commands.
# Without "2>&1" the gunicorn internal logging shows in 'docker logs' but doesn't go to stdout like our 'print' commands.
CMD ["sh", "-c", "gunicorn -b 0.0.0.0:3000 --log-level=debug --workers=1 app:app 2>&1"]

4
README.md

@ -2,6 +2,10 @@
## Docker Build & Deploy
- Update CHANGELOG.md
- Commit & tag with release version
```
export PUSH_SERVER_VERSION=0.1

5
app.py

@ -22,8 +22,9 @@ import time
CONTACT_EMAIL = "mailto:info@timesafari.app"
app = Flask(__name__)
PUSH_SERVER_VERSION = os.getenv('PUSH_SERVER_VERSION')
app = Flask(__name__)
class WebPushService():
@ -320,7 +321,7 @@ class WebPushService():
- Response: Text with some subscription-run info
"""
return f"pong ... with latest subscription run at {self.latest_subscription_run}"
return f"pong ... version {PUSH_SERVER_VERSION} ... with latest subscription run at {self.latest_subscription_run}"
# This is an endpoint, routed in __init__
def regenerate_vapid(self) -> Tuple[Response, int, dict[str, str]] | Tuple[Response, int]:

Loading…
Cancel
Save