-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
11,459 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
http://localhost { | ||
reverse_proxy /doc/ws/* y-sweet:8080 | ||
reverse_proxy /* demos:3000 | ||
} | ||
|
||
# To use a real domain with HTTPS, replace "http://localhost" with the domain | ||
# (omit http://). You will also need to change --url-prefix in docker-compose.yml | ||
# to reflect the domain. | ||
# | ||
# example.com { | ||
# reverse_proxy /doc/ws/* y-sweet:8080 | ||
# reverse_proxy /* demos:3000 | ||
# } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
This shows an example deployment using Docker Compose. This is suitable for setups where one y-sweet server is | ||
sufficient to handle the scale of requests. | ||
|
||
To run locally, run `docker compose up`. | ||
|
||
To use a custom domain with HTTPS, follow the commented instructions in `Caddyfile`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
services: | ||
y-sweet: | ||
restart: unless-stopped | ||
image: ghcr.io/jamsocket/y-sweet:latest | ||
build: | ||
dockerfile: Dockerfile | ||
context: ../crates | ||
command: | ||
"y-sweet serve ./data --host 0.0.0.0 --auth AXO33rILFt0ZOP7v9NM8e2u6m1pVWvCS5HI9mYMK --url-prefix=http://localhost/" | ||
volumes: | ||
- ./data:/data | ||
ports: | ||
- "8080:8080" | ||
|
||
demos: | ||
restart: unless-stopped | ||
build: | ||
dockerfile: Dockerfile | ||
context: ../examples/nextjs | ||
environment: | ||
- CONNECTION_STRING=ys://AAAg1s4QOZVQsRWT4p-CUrk3ory1a21SksuWR6hzqy-vFJM@y-sweet:8080 | ||
ports: | ||
- "3000:3000" | ||
|
||
caddy: | ||
image: caddy:2.8.4 | ||
restart: unless-stopped | ||
cap_add: | ||
- NET_ADMIN | ||
ports: | ||
- "80:80" | ||
- "443:443" | ||
volumes: | ||
- ./Caddyfile:/etc/caddy/Caddyfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# Source: https://github.com/vercel/next.js/blob/canary/examples/with-docker/Dockerfile | ||
|
||
FROM node:18-alpine AS base | ||
|
||
# Install dependencies only when needed | ||
FROM base AS deps | ||
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed. | ||
RUN apk add --no-cache libc6-compat | ||
WORKDIR /app | ||
|
||
# Install dependencies based on the preferred package manager | ||
COPY package.json docker-package-lock.json ./ | ||
RUN mv docker-package-lock.json package-lock.json | ||
RUN npm ci | ||
|
||
# Rebuild the source code only when needed | ||
FROM base AS builder | ||
WORKDIR /app | ||
COPY --from=deps /app/node_modules ./node_modules | ||
COPY . . | ||
|
||
# Next.js collects completely anonymous telemetry data about general usage. | ||
# Learn more here: https://nextjs.org/telemetry | ||
# Uncomment the following line in case you want to disable telemetry during the build. | ||
# ENV NEXT_TELEMETRY_DISABLED 1 | ||
|
||
RUN mv docker-package-lock.json package-lock.json | ||
|
||
RUN npm run build | ||
|
||
# Production image, copy all the files and run next | ||
FROM base AS runner | ||
WORKDIR /app | ||
|
||
ENV NODE_ENV production | ||
# Uncomment the following line in case you want to disable telemetry during runtime. | ||
# ENV NEXT_TELEMETRY_DISABLED 1 | ||
|
||
RUN addgroup --system --gid 1001 nodejs | ||
RUN adduser --system --uid 1001 nextjs | ||
|
||
# COPY --from=builder /app/public ./public | ||
|
||
# Set the correct permission for prerender cache | ||
RUN mkdir .next | ||
RUN chown nextjs:nodejs .next | ||
|
||
# Automatically leverage output traces to reduce image size | ||
# https://nextjs.org/docs/advanced-features/output-file-tracing | ||
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 | ||
|
||
# server.js is created by next build from the standalone output | ||
# https://nextjs.org/docs/pages/api-reference/next-config-js/output | ||
CMD HOSTNAME="0.0.0.0" node server.js |
Oops, something went wrong.