Skip to content

Commit

Permalink
Merge pull request #15 from Suke-H/#14-split-development-production
Browse files Browse the repository at this point in the history
#14 本番環境と開発環境で分ける
  • Loading branch information
Suke-H authored Sep 7, 2024
2 parents c16ae54 + 0ae61e6 commit 750c2b6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
17 changes: 12 additions & 5 deletions dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,30 @@
# Use an official Node.js runtime as a parent image
FROM node:18-slim

# Set build-time argument (default is 'production')
ARG NODE_ENV=production

# Set the environment variable based on the build argument
ENV NODE_ENV=${NODE_ENV}

# Set the working directory in the container to /app
WORKDIR /app

# Copy the package.json and package-lock.json files to the container
COPY package*.json ./

# Install the application dependencies
RUN npm install --production
# Install dependencies based on the environment
RUN if [ "$NODE_ENV" = "production" ]; then \
npm install --production; \
else \
npm install; \
fi

# Copy the rest of the application code to the container
COPY src/ ./src

# Expose the port the app runs on
EXPOSE 8080

# Define environment variable for production
ENV NODE_ENV=production

# Run the application
CMD ["node", "src/server.js"]
4 changes: 2 additions & 2 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ const config = {
NOTION_DATABASE_ID: process.env.NOTION_DATABASE_ID,

development: {
GOAL_SETTING_CRON: '*/10 * * * *', // 10分に1回
WEEKLY_REPORT_CRON: '*/10 * * * *' // 10分に1回
GOAL_SETTING_CRON: '*/2 * * * *', // 2分に1回
WEEKLY_REPORT_CRON: '*/2 * * * *' // 2分に1回
},

production: {
Expand Down

0 comments on commit 750c2b6

Please sign in to comment.