feat: update Dockerfile to run migrations at startup and adjust data volume path in docker-compose
This commit is contained in:
+4
-4
@@ -13,9 +13,9 @@ WORKDIR /app
|
||||
ENV NODE_ENV=production
|
||||
COPY --from=builder /app/node_modules ./node_modules
|
||||
COPY --from=builder /app/dist ./dist
|
||||
# Copy migration SQL files (needed for runtime migrations)
|
||||
COPY --from=builder /app/src/db/migrations ./dist/db/migrations
|
||||
COPY package.json .
|
||||
# Create data directory for runtime (will be mounted as volume)
|
||||
RUN mkdir -p /app/data && chown node:node /app/data
|
||||
USER node
|
||||
EXPOSE 3000
|
||||
CMD ["node", "dist/index.js"]
|
||||
# Run migrations before starting the server
|
||||
CMD ["sh", "-c", "mkdir -p /app/data && node dist/db/migrate.js && node dist/index.js"]
|
||||
|
||||
@@ -4,7 +4,7 @@ services:
|
||||
env_file:
|
||||
- .env
|
||||
volumes:
|
||||
- ./backend/data:/app/data
|
||||
- ./data:/app/data
|
||||
ports:
|
||||
- "4000:3000"
|
||||
healthcheck:
|
||||
|
||||
@@ -412,7 +412,9 @@ export default function App() {
|
||||
<h2>Reorder Reminder</h2>
|
||||
<span className="pill neutral">Stock watch</span>
|
||||
</div>
|
||||
{coverage.low.length === 0 ? (
|
||||
{meds.length === 0 ? (
|
||||
<p className="muted">No medications configured yet.</p>
|
||||
) : coverage.low.length === 0 ? (
|
||||
<p className="success-text">All good, enough stock.</p>
|
||||
) : (
|
||||
<>
|
||||
|
||||
Reference in New Issue
Block a user