diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..41c4ed8d --- /dev/null +++ b/.dockerignore @@ -0,0 +1,14 @@ +# Exclude host node_modules and build artifacts from the docker build context +**/node_modules +**/dist + +# Logs, env files +npm-debug.log* +.env +.env.* + +# OS files +.DS_Store + +# Optional: ignore local Dockerfiles if you build from subfolders +#Dockerfile diff --git a/treasury/Dockerfile b/treasury/Dockerfile index 973e89bc..bf815279 100644 --- a/treasury/Dockerfile +++ b/treasury/Dockerfile @@ -3,6 +3,9 @@ FROM node:${NODE_VERSION}-alpine AS builder WORKDIR /usr/src/app +# Install build dependencies for native modules +RUN apk add --no-cache python3 make g++ + COPY ./treasury/package*.json ./ RUN npm ci @@ -15,6 +18,9 @@ RUN npm run build FROM node:${NODE_VERSION}-alpine AS production WORKDIR /usr/src/app +# Install build dependencies temporarily for production dependencies +RUN apk add --no-cache python3 make g++ + COPY ./treasury/package*.json ./ RUN npm ci --production && npm cache clean --force @@ -23,4 +29,4 @@ COPY --from=builder /usr/src/app/dist ./dist EXPOSE 8080 -CMD ["node", "dist/main"] \ No newline at end of file +CMD ["node", "dist/src/main"] \ No newline at end of file