-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
64 lines (48 loc) · 1.34 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# ========================================
# Base image
# ========================================
FROM python:3.11-slim as base
ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONFAULTHANDLER 1
RUN pip install pipenv
# ========================================
# Build dependencies stage
# ========================================
FROM base as build-deps
# Copy Pipfiles
COPY Pipfile Pipfile.lock ./
# Install Python dependencies
ARG DEV
RUN PIPENV_VENV_IN_PROJECT=1 pipenv install --deploy $(if [ "$DEV" ]; then echo --dev; fi)
# ========================================
# Runtime stage
# ========================================
FROM base
LABEL org.opencontainers.image.source https://github.com/SBRG/lifelike
# Copy Python virtual environment
COPY --from=build-deps /.venv /.venv
ENV PATH="/.venv/bin:$PATH"
# Set user and working directory
WORKDIR /app
RUN useradd -m -d /app app
USER app
# Copy application code
COPY --chown=app main.py ./
# ArangoDB configuration
ENV ARANGODB_HOST=arangodb
ENV ARANGODB_PORT=7687
ENV ARANGODB_AUTH=arangodb/password
ENV ARANGODB_SCHEME=bolt
ENV ARANGODB_DATABASE=arangodb
# Redis cache configuration
ENV REDIS_HOST=redis
ENV REDIS_PORT=6379
ENV REDIS_PASSWORD=password
ENV REDIS_DB=0
# Default TTL for cache
ENV CACHE_TTL=86400
# Logging level
ENV LOG_LEVEL=INFO
CMD ["python", "main.py"]