Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .docker/.env.example

This file was deleted.

13 changes: 9 additions & 4 deletions .docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,24 @@ RUN corepack use pnpm@*
ARG WORKDIR=/chatbot_server
WORKDIR ${WORKDIR}

# Adding package.json first will cache our dependencies so
# that they do not have to be re-installed when the image rebuilds
# Add only package files for caching dependencies
ADD package.json ${WORKDIR}
ADD pnpm-lock.yaml ${WORKDIR}
ADD scripts/ /chatbot_server/scripts/
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this line is needed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reason: This allows shell scripts like start.sh and rebuild.sh to be included in the image, which are used during container setup.

Why it's needed: These scripts were referenced in the compose file and are required for container startup/refresh. Without adding them explicitly, containerized rebuild or start scripts would fail if not included by COPY/ADD.


# Install dependencies (with fallback)
# Install dependencies
RUN pnpm install

# Now copy the rest of the source files (including scripts/)
COPY . .

# Now chmod scripts - scripts/ exists now
RUN chmod +x ./scripts/*.sh || true

# Set up git
RUN apk add git
ADD git-config.txt ${WORKDIR}

EXPOSE 7000
EXPOSE 7000

CMD ['node', 'index.js']
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if we need to line 30 to successfully run ./scripts/rebuild.sh, ./scripts/start.sh

2 changes: 1 addition & 1 deletion .docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ services:
condition: service_healthy

chatbot_db:
hostname: postgres # Explicit hostname
hostname: localhost # Explicit hostname
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How did changing this value affect the changes?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

During local testing, services failed to connect to the database under the hostname postgres. Setting localhost resolved the issue locally, since it was my signup/in name in my admin profile.

This change may not be required if your networking is different, so I’m open to reverting or making it environment-specific (via .env or profiles).

image: postgres:15-alpine
container_name: chatbot_db
ports:
Expand Down
4 changes: 3 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
"db:migrate:test": "NODE_ENV=test pnpm db:migrate",
"db:generate-migration": "sequelize migration:generate",
"db:undo-migration": "sequelize db:migrate:undo",
"db:rollback-migrations": "sequelize db:migrate:undo:all",
"postinstall": "chmod +x ./scripts/*.sh"
"db:rollback-migrations": "sequelize db:migrate:undo:all"
},
"engines": {
"node": ">20.19.2"
Expand Down
Loading