-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile.dev
More file actions
79 lines (57 loc) · 1.83 KB
/
Dockerfile.dev
File metadata and controls
79 lines (57 loc) · 1.83 KB
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# Development Dockerfile for VISTA (RHEL/UBI9 Minimal based)
# Single image with Python 3.11 and Node.js for full-stack development
FROM registry.access.redhat.com/ubi9/ubi-minimal AS base
# Install Python 3.11, Node.js, and system dependencies
RUN microdnf install -y --nodocs \
python3.11 \
python3.11-pip \
python3.11-devel \
gcc \
gcc-c++ \
libpq-devel \
git \
ca-certificates \
nodejs \
npm \
shadow-utils \
&& microdnf clean all
# Create symlinks for python
RUN ln -sf /usr/bin/python3.11 /usr/bin/python3 && \
ln -sf /usr/bin/python3.11 /usr/bin/python
# Create appuser
RUN useradd -m -s /bin/bash appuser
# Create virtual environment
RUN python -m venv /opt/venv && chown -R appuser:appuser /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
# Install uv and debugging tools
RUN pip install --no-cache-dir --upgrade pip uv
WORKDIR /app
# Install Python dependencies (cached layer)
COPY pyproject.toml uv.lock ./
ENV UV_PROJECT_ENVIRONMENT=/opt/venv
RUN uv sync --frozen --no-install-project
# Copy backend code (will be overridden by volume mount in development)
COPY ./backend /app/backend
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
# Backend development stage
FROM base AS backend-dev
RUN chown -R appuser:appuser /app
WORKDIR /app/backend
EXPOSE 8000
USER appuser
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]
# Frontend development stage
FROM base AS frontend-dev
WORKDIR /app/frontend
# Copy package files first (for caching)
COPY frontend/package*.json ./
# Install dependencies and set ownership
RUN npm install && chown -R appuser:appuser /app
# Copy frontend source (will be overridden by volume mount in development)
COPY frontend/ ./
RUN chown -R appuser:appuser /app
EXPOSE 3000
USER appuser
CMD ["npm", "run", "dev"]