29 lines
725 B
Docker
29 lines
725 B
Docker
# Simple Dockerfile for the GPX viewer application
|
|
FROM node:18-alpine
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Copy all source files
|
|
COPY . .
|
|
|
|
# Build the GPX library first
|
|
WORKDIR /app/gpx
|
|
RUN npm install
|
|
RUN npm run build
|
|
|
|
# Then build and run the website
|
|
WORKDIR /app/website
|
|
RUN npm install
|
|
|
|
# Expose the port for the dev server
|
|
EXPOSE 5173
|
|
|
|
# Create a simple startup script that injects the token from env var
|
|
RUN echo '#!/bin/sh' > /app/start.sh && \
|
|
echo 'echo "PUBLIC_MAPBOX_TOKEN=$PUBLIC_MAPBOX_TOKEN" > /app/website/.env' >> /app/start.sh && \
|
|
echo 'cd /app/website && npm run dev -- --host 0.0.0.0' >> /app/start.sh && \
|
|
chmod +x /app/start.sh
|
|
|
|
# Command to start the application
|
|
CMD ["/app/start.sh"] |