-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
22 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,32 @@ | ||
# Use Node.js base image | ||
FROM node:20-bullseye-slim as base | ||
FROM node:20-bullseye-slim | ||
|
||
# Define environment variables | ||
ARG DATABASE_URL | ||
ENV DATABASE_URL=$DATABASE_URL | ||
ENV NODE_ENV=production | ||
|
||
# Setup production node_modules | ||
FROM base as production-deps | ||
# Set working directory | ||
# Create app directory | ||
WORKDIR /myapp | ||
|
||
COPY package.json package-lock.json ./ | ||
RUN rm -rf /myapp/node_modules && npm install | ||
# Copy package.json | ||
COPY package.json ./ | ||
|
||
# Debug: List node_modules | ||
RUN ls -la /myapp/node_modules && ls -la /myapp/node_modules/@slack/bolt | ||
# Set npm registry to the public registry | ||
RUN npm config set registry https://registry.npmjs.org/ | ||
|
||
from base | ||
# Install dependencies with verbose logging | ||
RUN npm install --verbose | ||
|
||
WORKDIR /myapp | ||
# Check if dotenv is installed | ||
RUN npm list dotenv | ||
|
||
# Debug: Show the contents of package.json | ||
RUN echo "Contents of package.json:" && cat package.json | ||
|
||
# Copy the rest of the application code without overwriting node_modules | ||
COPY --from=production-deps /myapp/node_modules /myapp/node_modules | ||
COPY app/ ./app/ | ||
COPY package.json package-lock.json ./ | ||
# Check node_modules content | ||
RUN echo "Contents of node_modules after npm install:" && ls -la /myapp/node_modules | ||
|
||
# Set runtime environment variables | ||
ENV DATABASE_URL=$DATABASE_URL | ||
ENV NODE_ENV=production | ||
# Check if dotenv is in node_modules | ||
RUN echo "Contents of dotenv after npm install:" && ls -la /myapp/node_modules/dotenv || echo "dotenv not found" | ||
|
||
EXPOSE 80 | ||
# Copy the application source code | ||
COPY . . | ||
|
||
EXPOSE 8080 | ||
# Command to run the app | ||
CMD ["npm", "start"] | ||
CMD ["npm", "start"] |