Skip to content

Instantly share code, notes, and snippets.

@spinningcat
Created February 6, 2025 18:49
Show Gist options
  • Save spinningcat/afa2c3131b8e17c4b3ebff1381f8eee2 to your computer and use it in GitHub Desktop.
Save spinningcat/afa2c3131b8e17c4b3ebff1381f8eee2 to your computer and use it in GitHub Desktop.
FROM amd64/alpine:3.21.2 AS base
# Copy the pre-built Node.js binary distribution
COPY ./docker/sources/node/binary/node-v22.13.1-linux-x64 /opt/nodejs
# Set environment variables to point to the copied Node.js installation
ENV NODE_HOME=/opt/nodejs
ENV PATH=$NODE_HOME/bin:$PATH
# Create symbolic link (if needed, check if node command available or not)
RUN ln -s ./GDSK/docker/sources/node/binary/node-v22.13.1-linux-x64/bin/node /usr/bin/node
RUN ln -s ./GDSK/docker/sources/node/binary/node-v22.13.1-linux-x64/bin/npm /usr/bin/npm
# Make sure executables have execute permissions
RUN chmod +x /opt/nodejs/bin/node /opt/nodejs/bin/npm
WORKDIR /usr/src/app
# Copy package.json and package-lock.json (if you have one)
COPY ./docker/sources/node/package*.json ./
#Copy pre-installed node modules
COPY ./docker/sources/node/node_modules ./node_modules
COPY ./docker/sources/node/index.js ./
COPY ./docker/sources/node/swagger.yaml ./
# Debugging commands - REMOVE THESE AFTER DEBUGGING
RUN echo "PATH: $PATH"
RUN which node
RUN which npm
RUN ls -l /opt/nodejs/bin/node
RUN ls -l /usr/bin/node
EXPOSE 9001
CMD ["node", "index.js"]
nodeapp-with-openapi2 | exec /opt/nodejs/bin/node: no such file or directory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment