Skip to content

Instantly share code, notes, and snippets.

@spinningcat
Created February 6, 2025 22:33
Show Gist options
  • Save spinningcat/202b9776b7234f5fd69e61d5c016b368 to your computer and use it in GitHub Desktop.
Save spinningcat/202b9776b7234f5fd69e61d5c016b368 to your computer and use it in GitHub Desktop.
FROM amd64/alpine:3.21.2 AS base
# Debug: Print working directory
RUN echo "Current working directory: $(pwd)"
# Copy the pre-built Node.js binary distribution
COPY ./docker/sources/node/binary/node-v14.4.0-linux-x64-musl /opt/nodejs
# Debug: List files in /opt/nodejs
RUN echo "Listing files in /opt/nodejs:" && ls -l /opt/nodejs/bin
# Set environment variables
ENV NODE_HOME=/opt/nodejs
ENV PATH=$NODE_HOME/bin:$PATH
# Debug: Print the PATH
RUN echo "PATH: $PATH"
# Make sure executables have execute permissions (IMPORTANT!)
RUN chmod +x /opt/nodejs/bin/node /opt/nodejs/bin/npm
# Debug: Check permissions
RUN ls -l /opt/nodejs/bin/node /opt/nodejs/bin/npm
RUN echo "Checking if /opt/nodejs/bin/node exists:" && [ -f /opt/nodejs/bin/node ] && echo "File exists" || echo "File does not exist"
RUN echo "Checking if /opt/nodejs/bin/node is executable:" && [ -x /opt/nodejs/bin/node ] && echo "Executable" || echo "Not executable"
RUN echo "Checking dependencies for /opt/nodejs/bin/node:" && ldd /opt/nodejs/bin/node || echo "ldd failed"
RUN echo "File permissions for /opt/nodejs/bin/node:" && ls -l /opt/nodejs/bin/node
WORKDIR /usr/src/app
# Copy package.json and package-lock.json (if you have one)
COPY ./docker/sources/node/package*.json ./
# Debug: List files after copy
RUN echo "Listing files in /usr/src/app:" && ls -l
COPY ./docker/sources/node/node_modules ./node_modules
COPY ./docker/sources/node/index.js ./
COPY ./docker/sources/node/swagger.yaml ./
# Debug: Verify index.js exists
RUN ls -l index.js
EXPOSE 9001
CMD ["node", "/usr/src/app/index.js"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment