Merge pull request #2 from caronc/docker-hub-integration

Docker hub integration
This commit is contained in:
Chris Caron 2020-01-04 15:16:56 -05:00 committed by GitHub
commit 39336ca6a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 100 additions and 14 deletions

57
Dockerfile Normal file
View File

@ -0,0 +1,57 @@
# Use the standard Nginx image from Docker Hub
FROM nginx
# set version label
ARG BUILD_DATE
ARG VERSION
ARG HEALTHCHECKS_RELEASE
LABEL build_version="Apprise API version:- ${VERSION} Build-date:- ${BUILD_DATE}"
LABEL maintainer="Chris-Caron"
# set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
ENV APPRISE_CONFIG_DIR /config
# Install Python Dependencies
COPY ./requirements.txt etc/requirements.txt
# Install Python
RUN apt-get update && \
apt-get install -y curl python3 python3-pip && \
pip3 install -r etc/requirements.txt gunicorn
# Install s6-overlay
RUN curl -fL -o /tmp/s6-overlay.tar.gz \
https://github.com/just-containers/s6-overlay/releases/download/v1.22.1.0/s6-overlay-amd64.tar.gz \
&& tar -xzf /tmp/s6-overlay.tar.gz -C / \
&& rm -rf /tmp/*
ENV S6_KEEP_ENV=1 \
S6_CMD_WAIT_FOR_SERVICES=1
# Copy our static content in place
COPY apprise_api/static /usr/share/nginx/html/s/
# System Configuration
COPY etc /etc/
# set work directory
WORKDIR /opt/apprise
# Copy over Apprise API
COPY apprise_api/ webapp
# gunicorn to expose on port 8080
# nginx to expose on port 8000
# disable logging on gunicorn
RUN \
sed -i -e 's/backend:8000/localhost:8080/g' \
-e 's/listen\([ \t]\+\)[^;]\+;/listen\18000;/g' \
/etc/nginx/conf.d/default.conf && \
sed -i -e 's/:8000/:8080/g' /opt/apprise/webapp/gunicorn.conf.py
EXPOSE 8000
VOLUME /config
ENTRYPOINT ["/init"]

View File

@ -2,8 +2,7 @@
FROM nginx
# Copy our customized NginX configuration (for container usage)
COPY apprise_api/nginx.conf /etc/nginx/nginx.conf
COPY apprise_api/apprise_api.conf /etc/nginx/conf.d/default.conf
COPY etc/nginx /etc/nginx/
# Copy our static content in place
COPY apprise_api/static /usr/share/nginx/html/s/

View File

@ -9,7 +9,8 @@ Take advantage of [Apprise](https://github.com/caronc/apprise) through your netw
Apprise API was designed to easily fit into existing (and new) eco-systems that are looking for a simple notification solution.
[![Paypal](https://img.shields.io/badge/paypal-donate-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=MHANV39UZNQ5E)
[![Discord](https://img.shields.io/discord/558793703356104724.svg?colorB=7289DA&label=Discord&logo=Discord&logoColor=7289DA&style=flat-square)](https://discord.gg/MMPeN2D)
[![Discord](https://img.shields.io/discord/558793703356104724.svg?colorB=7289DA&label=Discord&logo=Discord&logoColor=7289DA&style=flat-square)](https://discord.gg/MMPeN2D)<br/>
[![Docker Pulls](https://img.shields.io/docker/pulls/caronc/apprise.svg?style=flat-square)](https://hub.docker.com/r/caronc/apprise)
## Screenshots
There is a small built-in *Configuration Manager* that can be accesed using `/cfg/{KEY}`:<br/>
@ -18,6 +19,30 @@ There is a small built-in *Configuration Manager* that can be accesed using `/cf
Below is a screenshot of how you can set either a series of URL's to your `{KEY}`, or set your YAML and/or TEXT configuration below.
![Screenshot of GUI - Configuration](https://raw.githubusercontent.com/caronc/apprise-api/master/Screenshot-2.png)
## Installation
The following options should allow you to access the API at: `http://localhost:8000/` from your browser.
Using [dockerhub](https://hub.docker.com/r/caronc/apprise), you can do the following:
```bash
# Retrieve container
docker pull caronc/apprise:latest
# Start it up:
# /config is used for a persistent store, you do not have to mount
# this if you don't intend to use it.
docker run --name apprise \
-p 8000:8000 \
-v /var/lib/apprise/config:/config \
-d caronc/apprise:latest
```
A `docker-compose.yml` file is already set up to grant you an instant production ready simulated environment:
```bash
# Docker Compose
docker-compose up
```
## API Details
| Path | Description |
@ -49,17 +74,6 @@ The use of environment variables allow you to provide over-rides to default sett
| `DEBUG` | This defaults to `False` however can be set to `True`if defined with a non-zero value (such as `1`).
## Container Support
A `docker-compose.yml` file is already set up to grant you an instant production ready simulated environment:
```bash
# Docker Compose
docker-compose up
```
You can now access the API at: `http://localhost:8000/` from your browser.
## Development Environment
The following should get you a working development environment to test with:

5
etc/services.d/gunicorn/finish Executable file
View File

@ -0,0 +1,5 @@
#!/usr/bin/env sh
echo >&2 "gunicorn exited. code=${1}"
# terminate other services to exit from the container
exec s6-svscanctl -t /var/run/s6/services

3
etc/services.d/gunicorn/run Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/with-contenv sh
echo >&2 "Starting gunicorn"
exec gunicorn -c /opt/apprise/webapp/gunicorn.conf.py --worker-tmp-dir /dev/shm core.wsgi

5
etc/services.d/nginx/finish Executable file
View File

@ -0,0 +1,5 @@
#!/usr/bin/env sh
echo >&2 "nginx exited. code=${1}"
# terminate other services to exit from the container
exec s6-svscanctl -t /var/run/s6/services

3
etc/services.d/nginx/run Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/with-contenv sh
echo >&2 "Starting nginx"
nginx -g 'daemon off;'