diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..0d16104 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +.git +/uploads +/node_modules diff --git a/Dockerfile b/Dockerfile index c2ff187..3589681 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,19 +1,29 @@ -FROM node:16 +FROM node:20 # Create app directory WORKDIR /usr/src/app +# Copy app files (see .dockerignore) +COPY . ./ + # Install app dependencies -# A wildcard is used to ensure both package.json AND package-lock.json are copied -# where available (npm@5+) -COPY package*.json ./ +RUN npm install --omit=dev -# Download, and prepare the kepubify binary -RUN wget https://github.com/pgaskin/kepubify/releases/download/v4.0.4/kepubify-linux-64bit -RUN mv kepubify-linux-64bit /usr/local/bin/kepubify -RUN chmod +x /usr/local/bin/kepubify +# Download and install kepubify +RUN wget https://github.com/pgaskin/kepubify/releases/download/v4.0.4/kepubify-linux-64bit && \ + mv kepubify-linux-64bit /usr/local/bin/kepubify && \ + chmod +x /usr/local/bin/kepubify -COPY . . +# Download and install kindlegen +RUN wget https://archive.org/download/kindlegen2.9/kindlegen_linux_2.6_i386_v2_9.tar.gz && \ + mkdir kindlegen && \ + tar xvf kindlegen_linux_2.6_i386_v2_9.tar.gz --directory kindlegen && \ + cp kindlegen/kindlegen /usr/local/bin/kindlegen && \ + chmod +x /usr/local/bin/kindlegen && \ + rm -rf kindlegen + +# Create uploads directory if it doesn't exist +RUN mkdir uploads EXPOSE 3001 -CMD [ "node", "index" ] +CMD [ "npm", "start" ] diff --git a/docker-compose.yaml b/docker-compose.yaml index c1343a0..6b1a111 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -4,6 +4,6 @@ services: build: context: . dockerfile: ./Dockerfile - container_name: send3ereader + container_name: send2ereader ports: - 3001:3001