Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dockerfile and docker-compose.yml #32

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
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
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
42 changes: 42 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
FROM node:lts-bullseye as base

# Create a non-root user
RUN useradd -ms /bin/bash appuser

# Install sqlite3
RUN apt-get update && apt-get install -y sqlite3

# Set working directory
WORKDIR /app

# Copy package.json and package-lock.json
COPY package*.json ./

# Install dependencies
RUN npm install --production

# Copy the application code
COPY . .

# Create hebcal-dot-com.ini file
RUN mkdir -p /etc && touch /etc/hebcal-dot-com.ini

# Install additional dependencies
RUN npm install @hebcal/geo-sqlite

# Download and make databases
RUN ./node_modules/.bin/download-and-make-dbs

# Create a directory for logs
RUN mkdir -p /var/log/hebcal/
# Grant write permissions to the non-root user
RUN chown -R appuser:appuser /var/log/hebcal

# Set the user
USER appuser

# Expose the port (if applicable)
EXPOSE 8080

# Start the application
CMD ["node", "src/app-www.js"]
14 changes: 14 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: '3.7'

services:
hebcal-web:
container_name: hebcal-web
build:
context: .
dockerfile: Dockerfile
ports:
- "8080:8080"
environment:
- NODE_ENV=production
restart: unless-stopped

Loading