Merge pull request #31 from YaoSiQian/patch-1
Fix Docker stuff (with README guidance)
This commit is contained in:
26
README.md
26
README.md
@ -27,11 +27,13 @@ A free, open-source video editor for web, desktop, and mobile.
|
|||||||
## Getting Started
|
## Getting Started
|
||||||
|
|
||||||
1. **Clone the repository:**
|
1. **Clone the repository:**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git clone <repo-url>
|
git clone <repo-url>
|
||||||
cd OpenCut
|
cd OpenCut
|
||||||
```
|
```
|
||||||
2. **Install dependencies:**
|
2. **Install dependencies:**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd apps/web
|
cd apps/web
|
||||||
npm install
|
npm install
|
||||||
@ -39,16 +41,38 @@ A free, open-source video editor for web, desktop, and mobile.
|
|||||||
bun install
|
bun install
|
||||||
```
|
```
|
||||||
3. **Run the development server:**
|
3. **Run the development server:**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm run dev
|
npm run dev
|
||||||
# or, with Bun
|
# or, with Bun
|
||||||
bun run dev
|
bun run dev
|
||||||
```
|
```
|
||||||
|
4. **Open in browser:**
|
||||||
|
|
||||||
|
Visit [http://localhost:3000](http://localhost:3000)
|
||||||
|
|
||||||
|
## Run with Docker
|
||||||
|
1. **Prepare environment variables:**
|
||||||
|
|
||||||
|
Edit [docker-compose.yaml](https://github.com/OpenCut-app/OpenCut/blob/main/docker-compose.yaml#L57-L64)
|
||||||
|
2. **Build and run:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker-compose up -d --build
|
||||||
|
```
|
||||||
|
3. *(Optional)* **Migrate database:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker-compose exec web bun run db:migrate
|
||||||
|
```
|
||||||
4. **Open in browser:**
|
4. **Open in browser:**
|
||||||
|
|
||||||
Visit [http://localhost:3000](http://localhost:3000)
|
Visit [http://localhost:3000](http://localhost:3000)
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
|
Visit [CONTRIBUTING.md](.github/CONTRIBUTING.md)
|
||||||
|
=======
|
||||||
We welcome contributions! Please see our [Contributing Guide](.github/CONTRIBUTING.md) for detailed setup instructions and development guidelines.
|
We welcome contributions! Please see our [Contributing Guide](.github/CONTRIBUTING.md) for detailed setup instructions and development guidelines.
|
||||||
|
|
||||||
Quick start for contributors:
|
Quick start for contributors:
|
||||||
@ -59,4 +83,4 @@ Quick start for contributors:
|
|||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
MIT [Details](LICENSE)
|
[MIT LICENSE](LICENSE)
|
||||||
|
36
apps/web/Dockerfile
Normal file
36
apps/web/Dockerfile
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
FROM oven/bun:latest AS base
|
||||||
|
|
||||||
|
# Install dependencies
|
||||||
|
FROM base AS deps
|
||||||
|
WORKDIR /app
|
||||||
|
COPY package.json bun.lock ./
|
||||||
|
RUN bun install --frozen-lockfile
|
||||||
|
|
||||||
|
# Build the application
|
||||||
|
FROM base AS builder
|
||||||
|
WORKDIR /app
|
||||||
|
COPY --from=deps /app/node_modules ./node_modules
|
||||||
|
COPY . .
|
||||||
|
RUN bun run build
|
||||||
|
|
||||||
|
# Production image
|
||||||
|
FROM base AS runner
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
ENV NODE_ENV=production
|
||||||
|
|
||||||
|
RUN addgroup --system --gid 1001 nodejs
|
||||||
|
RUN adduser --system --uid 1001 nextjs
|
||||||
|
|
||||||
|
COPY --from=builder /app/public ./public
|
||||||
|
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
||||||
|
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
||||||
|
|
||||||
|
USER nextjs
|
||||||
|
|
||||||
|
EXPOSE 3000
|
||||||
|
|
||||||
|
ENV PORT=3000
|
||||||
|
ENV HOSTNAME="0.0.0.0"
|
||||||
|
|
||||||
|
CMD ["bun", "server.js"]
|
@ -18,7 +18,8 @@ services:
|
|||||||
start_period: 10s
|
start_period: 10s
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
image: redis
|
image: redis:7-alpine
|
||||||
|
restart: unless-stopped
|
||||||
ports:
|
ports:
|
||||||
- "6379:6379"
|
- "6379:6379"
|
||||||
healthcheck:
|
healthcheck:
|
||||||
@ -36,12 +37,46 @@ services:
|
|||||||
SRH_MODE: env
|
SRH_MODE: env
|
||||||
SRH_TOKEN: example_token
|
SRH_TOKEN: example_token
|
||||||
SRH_CONNECTION_STRING: "redis://redis:6379"
|
SRH_CONNECTION_STRING: "redis://redis:6379"
|
||||||
|
depends_on:
|
||||||
|
redis:
|
||||||
|
condition: service_healthy
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD-SHELL", "wget --spider -q http://127.0.0.1:80 || exit 1"]
|
test: ["CMD-SHELL", "wget --spider -q http://127.0.0.1:80 || exit 1"]
|
||||||
interval: 30s
|
interval: 30s
|
||||||
timeout: 10s
|
timeout: 10s
|
||||||
retries: 5
|
retries: 5
|
||||||
start_period: 10s
|
start_period: 10s
|
||||||
|
web:
|
||||||
volumes:
|
build:
|
||||||
|
context: ./apps/web
|
||||||
|
dockerfile: ./apps/web/Dockerfile
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- "3000:3000"
|
||||||
|
environment:
|
||||||
|
- NODE_ENV=production
|
||||||
|
- DATABASE_URL=postgresql://opencut:opencutthegoat@db:5432/opencut
|
||||||
|
- BETTER_AUTH_URL=http://localhost:3000
|
||||||
|
- BETTER_AUTH_SECRET=your-production-secret-key-here
|
||||||
|
- UPSTASH_REDIS_REST_URL=http://serverless-redis-http:80
|
||||||
|
- UPSTASH_REDIS_REST_TOKEN=example_token
|
||||||
|
- GOOGLE_CLIENT_ID=${GOOGLE_CLIENT_ID}
|
||||||
|
- GOOGLE_CLIENT_SECRET=${GOOGLE_CLIENT_SECRET}
|
||||||
|
depends_on:
|
||||||
|
db:
|
||||||
|
condition: service_healthy
|
||||||
|
serverless-redis-http:
|
||||||
|
condition: service_healthy
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD-SHELL", "curl -f http://localhost:3000/api/health || exit 1"]
|
||||||
|
interval: 30s
|
||||||
|
timeout: 10s
|
||||||
|
retries: 5
|
||||||
|
start_period: 30s
|
||||||
|
|
||||||
|
volumes:
|
||||||
postgres_data:
|
postgres_data:
|
||||||
|
|
||||||
|
networks:
|
||||||
|
default:
|
||||||
|
name: opencut-network
|
||||||
|
Reference in New Issue
Block a user