Skip to content

Commit

Permalink
aa
Browse files Browse the repository at this point in the history
  • Loading branch information
tjhorner committed Sep 14, 2024
1 parent 6c28d19 commit 67c1442
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 5 deletions.
12 changes: 8 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# BUILD FOR LOCAL DEVELOPMENT
###################

FROM node:18-alpine As development
FROM node:current AS development

# Create app directory
WORKDIR /usr/src/app
Expand All @@ -25,7 +25,7 @@ USER node
# BUILD FOR PRODUCTION
###################

FROM node:18-alpine As build
FROM node:current AS build

WORKDIR /usr/src/app

Expand All @@ -40,7 +40,7 @@ COPY --chown=node:node . .
RUN npm run build

# Set NODE_ENV environment variable
ENV NODE_ENV production
ENV NODE_ENV=production

# Running `npm ci` removes the existing node_modules directory and passing in --only=production ensures that only the production dependencies are installed. This ensures that the node_modules directory is as optimized as possible
RUN npm ci --only=production && npm cache clean --force
Expand All @@ -51,7 +51,11 @@ USER node
# PRODUCTION
###################

FROM node:18-alpine As production
FROM node:current AS production

RUN apt update && apt-get install -y pipx ffmpeg
RUN pipx install git+https://github.com/juanmcasillas/gopro2gpx
ENV PATH="$PATH:/root/.local/bin"

# Copy the bundled code from the build stage to the production image
COPY --chown=node:node --from=build /usr/src/app/node_modules ./node_modules
Expand Down
30 changes: 30 additions & 0 deletions docker-compose.prod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
services:
streetlens:
image: ghcr.io/tjhorner/streetlens:main
environment:
DATABASE_URL: postgres://postgres:postgres@postgres:5432/postgres
REDIS_HOST: redis
ports:
- "3000:3000"

redis:
image: redis:7
expose:
- "6379"
volumes:
- redis_data:/data

postgres:
image: postgis/postgis:15-3.4
expose:
- "5432"
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
volumes:
- postgres_data:/var/lib/postgresql/data

volumes:
postgres_data:
redis_data:
8 changes: 7 additions & 1 deletion src/tracks/track-import.processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,13 @@ export class TrackImportProcessor extends WorkerHost {
status: "Processing GPX data",
})

const gpxData = await this.getGpxData(job.data.filePath)
let gpxData: FeatureCollection
try {
gpxData = await this.getGpxData(job.data.filePath)
} catch {
throw new UnrecoverableError("Failed to process GPX data")
}

const trackFeature = gpxData.features.find(
(feat) => feat.geometry.type === "LineString",
)
Expand Down

0 comments on commit 67c1442

Please sign in to comment.