Calling on Docker Experts:
I find myself facing an intriguing challenge with my Node Packaging Manager (NPM) project. This project is composed of JavaScript, CSS, HTML/EJS, and SQLite3. While exploring Docker’s documentation, I have noticed that Docker appears to optimize MongoDB applications more efficiently than SQLite3, which is a more raw database application platform. However, when I attempt to build an image of my NPM project using Docker and its volume features, I encounter an error message from the Docker command prompt. This error occurs because the Docker volume (-v) attempts to include the SQLite3 module/library in the Linux configuration, but Linux doesn’t recognize the SQLite3 module/library. The error message looks like this:
Error: Cannot find module '/ivoteballot/node_modules/sqlite3/lib/binding/napi-v6-linux-musl-arm64/node_sqlite3.node'
I am currently facing a dilemma: should I seek expert guidance on addressing the deficiency of a SQLite3 “Docker Official Image” to incorporate as a port (-p), or should I consider rewriting all of my JavaScript code, which heavily relies on SQLite3, to make it compatible with a MongoDB application? I had designed my JavaScript code around SQLite3 for enhanced security control in my development project.
I am eager to hear any suggestions and recommendations from experts in the field. Please share your insights and advice.
Dockerfile Definition:
# Use an appropriate Node.js base image
FROM node:18-alpine
RUN npm install -g nodemon
# Set the working directory in the container
WORKDIR /ivoteballot
COPY controllers /ivoteballot/
COPY models /ivoteballot/
#
# Copy the rest of your application files to the container
COPY . .
# Copy package.json and package-lock.json to the container
COPY package.json /ivoteballot/
COPY package-lock.json /ivoteballot/
# Install dependencies
RUN npm install
EXPOSE 8080
# Define the command to start your Node.js application
#CMD ["node", "index.js"]
CMD ["npm", "run", "dev"]
Here are additional photographs for your review: