Working on dockerization
This commit is contained in:
parent
3ac56e2cbb
commit
0cb397fc46
4 changed files with 49 additions and 5 deletions
|
@ -5,7 +5,6 @@ import cherrypy
|
|||
|
||||
|
||||
def shim(app):
|
||||
cherrypy.tree.graft(app, "/")
|
||||
cherrypy.server.unsubscribe()
|
||||
server = cherrypy._cpserver.Server()
|
||||
|
||||
|
@ -13,15 +12,17 @@ def shim(app):
|
|||
cherrypy.config.update(
|
||||
{
|
||||
"environment": environment,
|
||||
"server.socket_host": host,
|
||||
"server.socket_port": port,
|
||||
"server.thread_pool": pool_size,
|
||||
"engine.autoreload.on": False,
|
||||
"log.screen": True,
|
||||
}
|
||||
)
|
||||
cherrypy.tree.graft(app, "/")
|
||||
|
||||
server.socket_host = host
|
||||
server.socket_port = port
|
||||
server.thread_pool = pool_size
|
||||
server.subscribe()
|
||||
|
||||
cherrypy.engine.start()
|
||||
cherrypy.engine.block()
|
||||
|
||||
|
|
|
@ -1,16 +1,19 @@
|
|||
py_project(
|
||||
name = "tentacles",
|
||||
shebang = "/usr/bin/env python3.11",
|
||||
zip_safe = False,
|
||||
main = "src/python/tentacles/__main__.py",
|
||||
main_deps = [
|
||||
"//projects/anosql",
|
||||
"//projects/anosql-migrations",
|
||||
"//projects/cherry-shim",
|
||||
py_requirement("attrs"),
|
||||
py_requirement("click"),
|
||||
py_requirement("flask"),
|
||||
py_requirement("jinja2"),
|
||||
py_requirement("octorest"),
|
||||
],
|
||||
main_data = [
|
||||
lib_data = [
|
||||
"//projects/tentacles/src/python/tentacles/static/css",
|
||||
],
|
||||
)
|
||||
|
|
25
projects/tentacles/Dockerfile
Normal file
25
projects/tentacles/Dockerfile
Normal file
|
@ -0,0 +1,25 @@
|
|||
FROM library/python:3.11
|
||||
MAINTAINER Reid 'arrdem' McKenzie <me@arrdem.com>
|
||||
|
||||
# RUN pip install --upgrade pip
|
||||
|
||||
RUN useradd -d /app app
|
||||
RUN mkdir -p /app /data
|
||||
RUN chown -R app:app /app /data
|
||||
USER app
|
||||
WORKDIR /app
|
||||
VOLUME /data
|
||||
ENV DOCKER_RUNNING=true
|
||||
|
||||
ENV PYTHONPATH="/app:${PYTHONPATH}"
|
||||
ENV PYTHONUNBUFFERED=true
|
||||
ENV PATH="/app/.local/bin:${PATH}"
|
||||
|
||||
### App specific crap
|
||||
# Deps vary least so do them first
|
||||
# RUN pip3 install --user install aiohttp aiohttp_basicauth async_lru cachetools click pycryptodome pyyaml retry
|
||||
|
||||
COPY --chown=app:app tentacles.zapp /app/app
|
||||
|
||||
EXPOSE 8080
|
||||
CMD ["/app/app"]
|
15
projects/tentacles/mkdocker.sh
Normal file
15
projects/tentacles/mkdocker.sh
Normal file
|
@ -0,0 +1,15 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -eoux -o pipefail
|
||||
|
||||
cd "$(dirname "$(realpath "$0")")"
|
||||
tmpdir=$(mktemp -d)
|
||||
|
||||
bazel build //projects/tentacles:tentacles.zapp
|
||||
zapp=$(realpath $(bazel run --run_under=echo //projects/tentacles:tentacles.zapp))
|
||||
|
||||
cp Dockerfile "$tmpdir/"
|
||||
cp -r "$zapp" "$tmpdir/"
|
||||
|
||||
cd "${tmpdir}"
|
||||
docker build "$@" -f Dockerfile .
|
Loading…
Reference in a new issue