diff --git a/Dockerfile b/Dockerfile index 2d0bed4..1d0e0fa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,18 +1,19 @@ -FROM alpine:3.10 -LABEL maintainer "Wes Lambert, wlambertts@gmail.com" -LABEL version="Unfurl Docker v0.2" +FROM python:3.11-alpine +LABEL maintainer="Wes Lambert, wlambertts@gmail.com" +LABEL version="Unfurl Docker v0.4" LABEL description="Run Unfurl in a Docker container" COPY requirements.txt /unfurl/requirements.txt +COPY requirements-ui.txt /unfurl/requirements-ui.txt -RUN apk update && apk add --no-cache git python3 && \ - if [ ! -e /usr/bin/pip ]; then ln -s pip3 /usr/bin/pip ; fi && \ - if [[ ! -e /usr/bin/python ]]; then ln -sf /usr/bin/python3 /usr/bin/python; fi && \ - pip3 install -r /unfurl/requirements.txt - -COPY unfurl/ /unfurl/unfurl/ -COPY *.py unfurl.ini /unfurl/ -RUN sed -i 's/^host.*/host = 0.0.0.0/' /unfurl/unfurl.ini +RUN apk update && apk add --no-cache git wget && \ + pip install --upgrade pip && \ + pip install -r /unfurl/requirements.txt && \ + pip install -r /unfurl/requirements-ui.txt +COPY . /unfurl/ WORKDIR /unfurl -ENTRYPOINT ["/usr/bin/python3", "unfurl_app.py"] +RUN pip install -e . + +EXPOSE 5000 +ENTRYPOINT ["python", "-c", "from unfurl.app import web_app; web_app()"] diff --git a/docker-compose.yaml b/docker-compose.yaml index 30ce769..22dbc43 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,11 +1,25 @@ -version: '2' services: unfurl: container_name: unfurl build: context: ./ dockerfile: Dockerfile - # Match the port defined in unfurl.ini ports: - "5000:5000" restart: unless-stopped + environment: + - PYTHONUNBUFFERED=1 + healthcheck: + test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:5000/"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 40s + volumes: + - ./unfurl.ini:/unfurl/unfurl.ini:ro + networks: + - unfurl-network + +networks: + unfurl-network: + driver: bridge