omnivore/packages/db/Dockerfile
Rohit Amarnath 008d5a36f1 feat: enhance user management by adding CSV support and password hashing
- Update .gitignore to include user credential files (users.csv, demo-users.csv).
- Modify Dockerfile to install bcryptjs globally for password hashing.
- Add script to hash passwords and copy it into the Docker image.
- Update setup.sh to create users from a CSV file if it exists, with error handling for password hashing.
- Introduce users.csv.example as a template for user data input.

This change improves user management by allowing bulk user creation from a CSV file and ensures secure password handling.
2025-09-23 12:53:16 -04:00

30 lines
719 B
Docker

FROM node:22.12
WORKDIR /app
COPY package.json .
COPY yarn.lock .
COPY tsconfig.json .
COPY /packages/db/package.json ./packages/db/package.json
RUN apt-get update && apt-get install -y \
postgresql \
uuid-runtime
RUN yarn install
# Install bcryptjs globally for password hashing
RUN npm install -g bcryptjs
ADD /packages/db ./packages/db
ADD /packages/db/setup.sh ./packages/db/setup.sh
# Copy the hash-password script
COPY packages/api/scripts/hash-password.js /usr/local/bin/hash-password.js
RUN chmod +x /usr/local/bin/hash-password.js
# Copy users.csv if it exists (optional file)
COPY packages/db/users.csv* /app/packages/db/ 2>/dev/null || true
CMD ["yarn", "workspace", "@omnivore/db", "migrate"]