change the container to be more production ready
This includes the code files in the docker image and creates a separate data dir, which means we don't need to manually mount files into the container anymore.
This commit is contained in:
parent
24aabd43f2
commit
af25d9c5a2
3 changed files with 12 additions and 3 deletions
2
.dockerignore
Normal file
2
.dockerignore
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
*.local
|
||||||
|
/data
|
||||||
|
|
@ -15,5 +15,10 @@ RUN pip install --no-cache-dir --upgrade --requirement requirements.txt
|
||||||
|
|
||||||
USER 10000:10001
|
USER 10000:10001
|
||||||
|
|
||||||
|
COPY . ./
|
||||||
|
|
||||||
|
ENV UNWIND_DATA="/data"
|
||||||
|
VOLUME ["/data"]
|
||||||
|
|
||||||
ENTRYPOINT ["/var/app/run"]
|
ENTRYPOINT ["/var/app/run"]
|
||||||
CMD ["server"]
|
CMD ["server"]
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,12 @@ from pathlib import Path
|
||||||
|
|
||||||
import toml
|
import toml
|
||||||
|
|
||||||
cachedir = (
|
|
||||||
Path(cachedir) if (cachedir := os.getenv("UNWIND_CACHEDIR", "./.cache")) else None
|
|
||||||
)
|
|
||||||
datadir = Path(os.getenv("UNWIND_DATA") or "./data")
|
datadir = Path(os.getenv("UNWIND_DATA") or "./data")
|
||||||
|
cachedir = (
|
||||||
|
Path(cachedir)
|
||||||
|
if (cachedir := os.getenv("UNWIND_CACHEDIR", datadir / ".cache"))
|
||||||
|
else None
|
||||||
|
)
|
||||||
debug = os.getenv("DEBUG") == "1"
|
debug = os.getenv("DEBUG") == "1"
|
||||||
loglevel = os.getenv("UNWIND_LOGLEVEL") or ("DEBUG" if debug else "INFO")
|
loglevel = os.getenv("UNWIND_LOGLEVEL") or ("DEBUG" if debug else "INFO")
|
||||||
storage_path = os.getenv("UNWIND_STORAGE", datadir / "db.sqlite")
|
storage_path = os.getenv("UNWIND_STORAGE", datadir / "db.sqlite")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue