-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
61 lines (49 loc) · 1.48 KB
/
Dockerfile
File metadata and controls
61 lines (49 loc) · 1.48 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
# Build stage
FROM node:26-alpine AS builder
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install dependencies
RUN npm ci
# Copy source files
COPY . .
# Run tests
RUN npm test
# Build library and examples
RUN npm run build && npm run build:examples
# Production stage
FROM nginx:alpine
# Copy built examples to nginx (served under /geolibre-plugin-template/ to match Vite base path)
COPY --from=builder /app/dist-examples /usr/share/nginx/html/geolibre-plugin-template
# Copy custom nginx config
RUN echo 'server { \
listen 80; \
server_name localhost; \
root /usr/share/nginx/html; \
index index.html; \
\
location /geolibre-plugin-template/ { \
try_files $uri $uri/ /geolibre-plugin-template/index.html; \
} \
\
location = / { \
return 302 /geolibre-plugin-template/; \
} \
}' > /etc/nginx/conf.d/default.conf
EXPOSE 80
# Startup script that prints URL and starts nginx
RUN printf '#!/bin/sh\n\
echo ""\n\
echo "======================================================"\n\
echo " MapLibre GL Plugin Template Examples"\n\
echo "======================================================"\n\
echo ""\n\
echo " Server running on port 80"\n\
echo ""\n\
echo " If you ran: docker run -p 8080:80 ..."\n\
echo " Open: http://localhost:8080/geolibre-plugin-template/"\n\
echo ""\n\
echo "======================================================"\n\
echo ""\n\
exec nginx -g "daemon off;"\n' > /start.sh && chmod +x /start.sh
CMD ["/start.sh"]