Skip to content

Commit

Permalink
Merge pull request #136 from outlyer-net/docker-image-shrink
Browse files Browse the repository at this point in the history
Reduce docker image size
  • Loading branch information
timoschlueter committed May 14, 2024
2 parents adbda12 + 3b15a13 commit 11119d0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.git*
README.md
22 changes: 16 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
FROM node:20-bookworm
LABEL description="Script written in TypeScript that uploads CGM readings from LibreLink Up to Nightscout"
FROM node:20-bookworm-slim AS build-stage

# Create app directory
RUN mkdir -p /usr/src/app
Expand All @@ -13,9 +12,20 @@ RUN npm install
COPY . /usr/src/app

# Run tests
RUN npm run test
RUN npm run test ; \
rm -r tests coverage

# Compile
RUN npm run build

RUN rm -r tests
RUN rm -r coverage
# Remove devel-only dependencies
RUN npm prune --omit dev

FROM node:20-bookworm-slim
LABEL description="Script written in TypeScript that uploads CGM readings from LibreLink Up to Nightscout"

COPY --from=build-stage /usr/src/app /usr/src/app

WORKDIR /usr/src/app

CMD [ "npm", "start" ]
CMD [ "npm", "run", "start-heroku" ]

0 comments on commit 11119d0

Please sign in to comment.