-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile.dev
More file actions
61 lines (51 loc) · 1.21 KB
/
Dockerfile.dev
File metadata and controls
61 lines (51 loc) · 1.21 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
# syntax=docker/dockerfile:1.6
# Development Dockerfile with all tools
# Requires Docker BuildKit (DOCKER_BUILDKIT=1)
FROM python:3.13-alpine
# Install build and development dependencies
RUN apk add --no-cache \
gcc \
musl-dev \
libffi-dev \
openssl-dev \
python3-dev \
libxml2-dev \
libxslt-dev \
git \
bash \
curl \
make \
cargo \
&& pip install --upgrade pip poetry
# Install development tools
RUN pip install --no-cache-dir \
ipython \
ipdb \
black \
isort \
flake8 \
mypy \
pytest \
pytest-asyncio \
pytest-cov
# Create non-root user with sudo capabilities
RUN addgroup -g 1000 -S appuser && \
adduser -u 1000 -S appuser -G appuser && \
echo "appuser ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/appuser
# Set working directory
WORKDIR /app
# Copy all files
COPY . .
# Install all dependencies including dev
RUN poetry config virtualenvs.create false && \
poetry install --with dev --with docs
# Change ownership
RUN chown -R appuser:appuser /app
# Switch to non-root user
USER appuser
# Set environment variables
ENV PYTHONPATH=/app/src
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
# Default to bash shell
CMD ["/bin/bash"]