Skip to content

Commit

Permalink
Use node:bookworm-slim instead of ubuntu image
Browse files Browse the repository at this point in the history
- Size of final Ubuntu image: `652MB`
- Size of final Node:bookworm-slim image: `361MB`

Additionally, flexibly sets the path for `libjemalloc` based off the container's architecture.
  • Loading branch information
Mythicaeda authored and goetzrrGit committed Jun 26, 2024
1 parent a85aff7 commit 4a58a84
Showing 1 changed file with 7 additions and 15 deletions.
22 changes: 7 additions & 15 deletions sequencing-server/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
FROM node:18.20-bookworm-slim

## Use a Debian-based image for apt-get compatibility
FROM ubuntu:24.04
# Install jemalloc
RUN apt-get update \
&& apt-get install --no-install-recommends -y libjemalloc-dev

# Update package lists
RUN apt-get update && apt-get install --no-install-recommends -y curl gnupg ca-certificates
# Set the path for jemalloc
RUN echo "/usr/lib/$(uname -m)-linux-gnu/libjemalloc.so" >> /etc/ld.so.preload

# Install NodeSource repository for node 18 LTS
RUN curl -sL https://deb.nodesource.com/setup_18.x | bash -

# Update package lists again after adding NodeSource
RUN apt-get update && apt-get install --no-install-recommends -y nodejs

# Install jemalloc and set the path
RUN apt-get update && apt-get install --no-install-recommends -y libjemalloc-dev \
&& echo "/usr/lib/x86_64-linux-gnu/libjemalloc.so" >> /etc/ld.so.preload

# Set working directory (optiona
# Set working directory
COPY . /app
WORKDIR /app
CMD [ "npm", "start" ]

0 comments on commit 4a58a84

Please sign in to comment.