-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDockerfile
More file actions
40 lines (27 loc) · 1.12 KB
/
Dockerfile
File metadata and controls
40 lines (27 loc) · 1.12 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
# https://hub.docker.com/_/node
FROM node:22-alpine AS BUILD_IMAGE
ARG CACHEBUST=1
# Create and change to the app directory.
WORKDIR /usr/src/app
# Copy application dependency manifests to the container image.
# A wildcard is used to ensure both package.json AND package-lock.json are copied.
# Copying this separately prevents re-running npm install on every code change.
COPY package*.json ./
# Install production dependencies.
RUN npm install --only=production
RUN apk add --no-cache tzdata
ENV TZ=Europe/Kyiv
# Copy local code to the container image.
COPY . ./
RUN echo "$CACHEBUST"
RUN apk --no-cache add curl && curl --silent --head "https://track.ua-gis.com/gtfs/lviv/static.zip" | grep 'Last-Modified:' | cut -c 16- > ./last-modified.txt
RUN node ./gtfs-import.js
FROM node:22-alpine
WORKDIR /usr/src/app
COPY . ./
COPY --from=BUILD_IMAGE /usr/src/app/node_modules ./node_modules
COPY --from=BUILD_IMAGE /usr/src/app/database/Timetable ./database/Timetable
COPY --from=BUILD_IMAGE /usr/src/app/last-modified.txt ./last-modified.txt
RUN node ./gtfs-import-slim.js
# Run the web service on container startup.
CMD [ "npm", "start" ]