-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
75 lines (53 loc) · 2.07 KB
/
Dockerfile
File metadata and controls
75 lines (53 loc) · 2.07 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
FROM node:20-alpine as frontend-builder
ARG NUXT_PUBLIC_MAPBOX_TOKEN
ENV NUXT_PUBLIC_MAPBOX_TOKEN=$NUXT_PUBLIC_MAPBOX_TOKEN
ARG NUXT_PUBLIC_GOOGLE_MAPS_API_KEY
ENV NUXT_PUBLIC_GOOGLE_MAPS_API_KEY=$NUXT_PUBLIC_GOOGLE_MAPS_API_KEY
ARG NUXT_PUBLIC_GTAG_ID
ENV NUXT_PUBLIC_GTAG_ID=$NUXT_PUBLIC_GTAG_ID
WORKDIR /app/frontend/BikeabilityUI
# Install build dependencies including git (required for some npm packages)
RUN apk add --no-cache python3 make g++ git
# Copy package files first (better Docker layer caching)
COPY frontend/BikeabilityUI/package*.json ./
RUN npm ci --no-fund --no-audit
# Completely clean install - no cache, no force, handle Node 20 specific issues
# RUN npm install --no-fund --no-audit
# Verify installation worked
RUN ls -la node_modules/.bin/nuxt && \
node -e "console.log('Node version:', process.version)" && \
npx nuxt --version
# Now copy the rest of the source code
COPY frontend/BikeabilityUI/ ./
# Build the application (remove the fallback, fix the root cause)
RUN npm run generate
# Rest of Dockerfile stays the same
FROM python:3.11-slim
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
gcc \
curl \
&& rm -rf /var/lib/apt/lists/*
# Create user early to avoid permission issues with rootless Docker
RUN groupadd -g 1000 appgroup && \
useradd -u 1000 -g appgroup -m -s /bin/bash appuser
# Copy and install Python requirements
COPY backend/requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy backend code
COPY backend/ ./
RUN touch __init__.py && \
touch Bikeability/__init__.py && \
touch Bikeability/routing/__init__.py && \
touch Bikeability/routing/flask_api/__init__.py
ENV PYTHONPATH=/app:$PYTHONPATH
# Copy built frontend (adjust path based on Nuxt output)
COPY --from=frontend-builder /app/frontend/BikeabilityUI/.output/public ./static/
# Change ownership of all app files to appuser
RUN chown -R appuser:appgroup /app
# Switch to non-root user
USER appuser
EXPOSE 5000
# Run with Gunicorn using wsgi.py
CMD ["gunicorn", "-c", "gunicorn_config.py", "wsgi:app"]