From f379fba930bbca99eb336c5828a0e74494b26d21 Mon Sep 17 00:00:00 2001 From: Traines Date: Tue, 10 Dec 2024 22:50:15 +0000 Subject: [PATCH] add Dockerfile --- Dockerfile | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..a5f26309 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,40 @@ +FROM node:18-alpine as builder +WORKDIR /app + +# install dependencies +RUN apk add --update git bash +ADD package.json package-lock.json /app +RUN npm ci + +# build documentation +ADD . /app +#RUN npm run build + +# --- + +FROM node:18-alpine +LABEL org.opencontainers.image.title="db-vendo-client" +LABEL org.opencontainers.image.description="A clean REST API wrapping around the new Deutsche Bahn API." +LABEL org.opencontainers.image.authors="Traines " +LABEL org.opencontainers.image.documentation="https://github.com/public-transport/db-vendo-client" +LABEL org.opencontainers.image.source="https://github.com/public-transport/db-vendo-client" +LABEL org.opencontainers.image.revision="6" +LABEL org.opencontainers.image.licenses="ISC" +WORKDIR /app + +# install dependencies +ADD package.json /app +RUN npm install --production && npm cache clean --force + +# add source code +ADD . /app +COPY --from=builder /app/docs ./docs + +EXPOSE 3000 + +ENV HOSTNAME v6.db.transport.rest +ENV PORT 3000 + +VOLUME /logs/ + +CMD ["node", "api.js"]