-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
48 lines (36 loc) · 1.05 KB
/
Copy pathDockerfile
File metadata and controls
48 lines (36 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# Use Node.js 20 LTS as the base image
FROM node:20-alpine
# Set working directory
WORKDIR /app
# Install dependencies for better-sqlite3 and other native modules
RUN apk add --no-cache python3 make g++ sqlite
# Copy package files
COPY package*.json ./
# Install ALL dependencies (including dev dependencies needed at runtime)
RUN npm ci
# Copy source code
COPY src ./src
COPY drizzle ./drizzle
COPY drizzle.config.ts ./drizzle.config.ts
COPY svelte.config.js ./svelte.config.js
COPY vite.config.ts ./vite.config.ts
COPY tsconfig.json ./tsconfig.json
COPY tailwind.config.js ./tailwind.config.js
COPY eslint.config.js ./eslint.config.js
COPY static ./static
# Build the application inside Docker
RUN npm run build
# Create an empty database file if it doesn't exist
RUN touch notes.db
# Copy database if it exists (but don't fail if it doesn't)
COPY notes.db* ./
# Copy startup script
COPY start.sh ./start.sh
RUN chmod +x start.sh
# Expose ports
EXPOSE 3001 80
# Set environment variables
ENV NODE_ENV=production
ENV PORT=80
# Start both servers
CMD ["./start.sh"]