add: docker tmpfs vol

v0.1
rrr-marble 4 years ago
parent e25c0d0382
commit 6d21c5083d

@ -6,6 +6,8 @@ services:
build: build:
context: ../src/ context: ../src/
dockerfile: Dockerfile dockerfile: Dockerfile
volumes:
- tmp_vol:/tmp
postgres: postgres:
image: "postgres:13-bullseye" image: "postgres:13-bullseye"
@ -13,3 +15,9 @@ services:
POSTGRES_USER: "geodata" POSTGRES_USER: "geodata"
POSTGRES_DB: "geodata" POSTGRES_DB: "geodata"
POSTGRES_PASSWORD: "QAKvBKvLe4bS9U" POSTGRES_PASSWORD: "QAKvBKvLe4bS9U"
volumes:
tmp_vol:
driver_opts:
type: tmpfs
device: tmpfs

@ -34,7 +34,7 @@ def parse(file: UploadFile = File(...)):
suffix = Path(file.filename).suffix suffix = Path(file.filename).suffix
try: try:
# TODO: decide if we use subdir in /tmp here, then create it [5] # TODO: decide if we use subdir in /tmp here, then create it [5]
with NamedTemporaryFile(delete=False, suffix=suffix, dir="/tmp/notgeo") as tmp: with NamedTemporaryFile(delete=False, suffix=suffix, dir="/tmp") as tmp:
copyfileobj(file.file, tmp) copyfileobj(file.file, tmp)
spreadsheet_file = Path(tmp.name) spreadsheet_file = Path(tmp.name)

Loading…
Cancel
Save