mirror of
https://github.com/marcogll/TaxHacker_s23.git
synced 2026-01-13 13:25:18 +00:00
ci: improve first install
This commit is contained in:
@@ -25,6 +25,11 @@ RUN npm run build
|
|||||||
# Production stage
|
# Production stage
|
||||||
FROM node:23-slim
|
FROM node:23-slim
|
||||||
|
|
||||||
|
# Default environment variables
|
||||||
|
ENV UPLOAD_PATH=/app/uploads
|
||||||
|
ENV NODE_ENV=production
|
||||||
|
ENV DATABASE_URL=file:/app/data/db.sqlite
|
||||||
|
|
||||||
# Install required system dependencies
|
# Install required system dependencies
|
||||||
RUN apt-get update && apt-get install -y \
|
RUN apt-get update && apt-get install -y \
|
||||||
ghostscript \
|
ghostscript \
|
||||||
@@ -36,7 +41,7 @@ RUN apt-get update && apt-get install -y \
|
|||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Create upload directory and set permissions
|
# Create upload directory and set permissions
|
||||||
RUN mkdir -p /app/upload && chown -R node:node /app/upload
|
RUN mkdir -p /app/upload
|
||||||
|
|
||||||
# Copy built assets from builder
|
# Copy built assets from builder
|
||||||
COPY --from=builder /app/node_modules ./node_modules
|
COPY --from=builder /app/node_modules ./node_modules
|
||||||
|
|||||||
@@ -125,10 +125,8 @@ Deploy your own instance of TaxHacker with Vercel in just a few clicks:
|
|||||||
For server deployment, we provide a [Docker image](./Dockerfile) and [Docker Compose](./docker-compose.yml) files that makes setting up TaxHacker simple:
|
For server deployment, we provide a [Docker image](./Dockerfile) and [Docker Compose](./docker-compose.yml) files that makes setting up TaxHacker simple:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Download docker-compose.yml file
|
|
||||||
curl -O https://raw.githubusercontent.com/vas3k/TaxHacker/main/docker-compose.yml
|
curl -O https://raw.githubusercontent.com/vas3k/TaxHacker/main/docker-compose.yml
|
||||||
|
|
||||||
# Run it
|
|
||||||
docker compose up
|
docker compose up
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -191,13 +189,13 @@ npx prisma migrate dev && npx prisma generate
|
|||||||
# Seed the database with default data (optional)
|
# Seed the database with default data (optional)
|
||||||
npm run seed
|
npm run seed
|
||||||
|
|
||||||
# Start the development server with Turbopack
|
# Start the development server
|
||||||
npm run dev
|
npm run dev
|
||||||
```
|
```
|
||||||
|
|
||||||
Visit `http://localhost:3000` to see your local instance of TaxHacker.
|
Visit `http://localhost:3000` to see your local instance of TaxHacker.
|
||||||
|
|
||||||
For a production build:
|
For a production build, instead of `npm run dev` use the following commands:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Build the application
|
# Build the application
|
||||||
|
|||||||
@@ -5,11 +5,9 @@ set -e
|
|||||||
echo "Running database migrations..."
|
echo "Running database migrations..."
|
||||||
npx prisma migrate deploy
|
npx prisma migrate deploy
|
||||||
|
|
||||||
# Run database seeding if SEED_DATABASE is set to true
|
# Initialize database
|
||||||
if [ "$SEED_DATABASE" = "true" ]; then
|
echo "Checking and seeding database if needed..."
|
||||||
echo "Seeding database..."
|
|
||||||
npm run seed
|
npm run seed
|
||||||
fi
|
|
||||||
|
|
||||||
# Start the application
|
# Start the application
|
||||||
echo "Starting the application..."
|
echo "Starting the application..."
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
"name": "taxhacker",
|
"name": "taxhacker",
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "next dev --turbopack",
|
"dev": "next dev --turbopack",
|
||||||
"build": "next build",
|
"build": "next build",
|
||||||
|
|||||||
@@ -1,5 +1,15 @@
|
|||||||
import { PrismaClient } from "@prisma/client"
|
import { PrismaClient } from "@prisma/client"
|
||||||
const prisma = new PrismaClient()
|
|
||||||
|
const DATABASE_URL = process.env.DATABASE_URL || "file:./db.sqlite"
|
||||||
|
const prisma = new PrismaClient({
|
||||||
|
datasources: {
|
||||||
|
db: {
|
||||||
|
url: DATABASE_URL,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const forceSeed = process.argv.includes("--force")
|
||||||
|
|
||||||
const settings = [
|
const settings = [
|
||||||
{
|
{
|
||||||
@@ -410,13 +420,19 @@ const fields = [
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
async function isDatabaseEmpty() {
|
||||||
|
const fieldsCount = await prisma.field.count()
|
||||||
|
return fieldsCount === 0
|
||||||
|
}
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
// Clean up existing data
|
const isEmpty = await isDatabaseEmpty()
|
||||||
// await prisma.category.deleteMany({})
|
if (!isEmpty && !forceSeed) {
|
||||||
// await prisma.currency.deleteMany({})
|
console.log("Database is already seeded. Use 'npm run seed -- --force' to force reseeding.")
|
||||||
// await prisma.field.deleteMany({})
|
return
|
||||||
// await prisma.setting.deleteMany({})
|
}
|
||||||
// await prisma.project.deleteMany({})
|
|
||||||
|
console.log("Starting database seeding...")
|
||||||
|
|
||||||
// Seed projects
|
// Seed projects
|
||||||
for (const project of projects) {
|
for (const project of projects) {
|
||||||
|
|||||||
Reference in New Issue
Block a user