37 lines
1009 B
Docker
37 lines
1009 B
Docker
# Build stage for gpx library
|
|
FROM node:20-alpine AS gpx-builder
|
|
WORKDIR /app/gpx
|
|
COPY gpx/package*.json ./
|
|
RUN npm install
|
|
COPY gpx/ ./
|
|
RUN npm run build
|
|
|
|
# Build stage for website
|
|
FROM node:20-alpine AS website-builder
|
|
WORKDIR /app/website
|
|
COPY website/package*.json ./
|
|
RUN npm install
|
|
COPY website/ ./
|
|
COPY --from=gpx-builder /app/gpx/dist /app/gpx/dist
|
|
# RUN npm link /app/gpx
|
|
|
|
ENV PUBLIC_MAPBOX_TOKEN="pk"
|
|
RUN npm run build
|
|
|
|
FROM node:20-alpine
|
|
WORKDIR /app
|
|
COPY --from=website-builder /app/website/package*.json ./
|
|
COPY --from=website-builder /app/website/build ./build
|
|
COPY --from=website-builder /app/website/node_modules ./node_modules
|
|
COPY --from=website-builder /app/website/build/index.html ./build/index.html.template
|
|
|
|
RUN echo '#!/bin/sh\ncat ./build/index.html.template | sed "s/pk.dummy_token_for_build/$PUBLIC_MAPBOX_TOKEN/g" > ./build/index.html\nexec node build' > ./start.sh && \
|
|
chmod +x ./start.sh
|
|
|
|
EXPOSE 3000
|
|
|
|
ENV NODE_ENV=production
|
|
ENV PUBLIC_MAPBOX_TOKEN=""
|
|
|
|
CMD ["./start.sh"]
|