Docker should now work
This commit is contained in:
parent
9918001d29
commit
7671af5cbe
11 changed files with 1551 additions and 40 deletions
21
.github/workflows/build.yml
vendored
Normal file
21
.github/workflows/build.yml
vendored
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types: [created]
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: denoland/setup-deno@v2
|
||||||
|
with:
|
||||||
|
deno-version: v2.x
|
||||||
|
- name: "Build app"
|
||||||
|
run: |
|
||||||
|
deno run build
|
||||||
|
- name: "Zip container"
|
||||||
|
run: |
|
||||||
|
zip -r container.zip ./container
|
||||||
|
- name: "Upload to release"
|
||||||
|
uses: svenstaro/upload-release-action@2.9.0
|
||||||
|
with:
|
||||||
|
file: "./container.zip"
|
38
README.md
38
README.md
|
@ -1,38 +1,2 @@
|
||||||
# create-svelte
|
# bluffit
|
||||||
|
|
||||||
Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/main/packages/create-svelte).
|
|
||||||
|
|
||||||
## Creating a project
|
|
||||||
|
|
||||||
If you're seeing this, you've probably already done this step. Congrats!
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# create a new project in the current directory
|
|
||||||
npm create svelte@latest
|
|
||||||
|
|
||||||
# create a new project in my-app
|
|
||||||
npm create svelte@latest my-app
|
|
||||||
```
|
|
||||||
|
|
||||||
## Developing
|
|
||||||
|
|
||||||
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npm run dev
|
|
||||||
|
|
||||||
# or start the server and open the app in a new browser tab
|
|
||||||
npm run dev -- --open
|
|
||||||
```
|
|
||||||
|
|
||||||
## Building
|
|
||||||
|
|
||||||
To create a production version of your app:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npm run build
|
|
||||||
```
|
|
||||||
|
|
||||||
You can preview the production build with `npm run preview`.
|
|
||||||
|
|
||||||
> To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment.
|
|
||||||
|
|
3
container/.gitignore
vendored
Normal file
3
container/.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
app
|
||||||
|
run
|
||||||
|
.vscode
|
15
container/Dockerfile
Normal file
15
container/Dockerfile
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
FROM denoland/deno:ubuntu-2.0.0
|
||||||
|
|
||||||
|
# This is the app that runs on port (env PORT)
|
||||||
|
COPY app/ /home/app
|
||||||
|
# This is the proxy that
|
||||||
|
# runs the app in the background
|
||||||
|
# AND lisens to (env SOCK) and forwards to localhost:(env PORT)
|
||||||
|
COPY proxy.ts /home/proxy.ts
|
||||||
|
|
||||||
|
RUN mkdir -p /var/run/proxy
|
||||||
|
|
||||||
|
ENV PORT=80
|
||||||
|
ENV SOCK="/var/run/proxy/app.sock"
|
||||||
|
|
||||||
|
ENTRYPOINT [ "deno", "run", "-A", "--unstable-worker-options", "./home/proxy.ts" ]
|
9
container/docker-compose.yml
Normal file
9
container/docker-compose.yml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
version: '3'
|
||||||
|
name: "bluffit"
|
||||||
|
|
||||||
|
services:
|
||||||
|
app:
|
||||||
|
container_name: "app"
|
||||||
|
build: .
|
||||||
|
volumes:
|
||||||
|
- ./run/:/var/run/proxy/
|
22
container/proxy.ts
Normal file
22
container/proxy.ts
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
const SOCKET = Deno.env.get("SOCK");
|
||||||
|
const PORT = Deno.env.get("PORT");
|
||||||
|
|
||||||
|
if(!SOCKET || !PORT) {
|
||||||
|
throw new Error("Missing port and socket env vars")
|
||||||
|
}
|
||||||
|
|
||||||
|
const worker = new Worker(new URL("./app/index.js", import.meta.url), {
|
||||||
|
deno: {
|
||||||
|
permissions: 'inherit'
|
||||||
|
},
|
||||||
|
name: 'server',
|
||||||
|
type: 'module'
|
||||||
|
})
|
||||||
|
|
||||||
|
worker.onerror = (e: ErrorEvent) => {
|
||||||
|
throw new Error(e.message)
|
||||||
|
}
|
||||||
|
|
||||||
|
Deno.serve({ path: SOCKET }, async (req) => {
|
||||||
|
return await fetch(`http://localhost:${PORT}`, req)
|
||||||
|
})
|
6
container/run.sh
Executable file
6
container/run.sh
Executable file
|
@ -0,0 +1,6 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
docker-compose down
|
||||||
|
rm -rf ./run
|
||||||
|
docker image remove bluffit-app
|
||||||
|
docker-compose up
|
12
container/update.sh
Executable file
12
container/update.sh
Executable file
|
@ -0,0 +1,12 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||||
|
|
||||||
|
docker-compose down
|
||||||
|
docker image remove bluffit-app
|
||||||
|
|
||||||
|
cd ..
|
||||||
|
rm -rf "$DIR" &
|
||||||
|
curl -0 "https://github.com/mavdotjs/bluffit/releases/latest/download/container.zip"
|
||||||
|
unzip ./container.zip
|
||||||
|
cd container
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"name": "finallydoingthisfunkyahhcardgame",
|
"name": "bluffit",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -23,6 +23,7 @@
|
||||||
"prettier": "^3.1.1",
|
"prettier": "^3.1.1",
|
||||||
"prettier-plugin-svelte": "^3.1.2",
|
"prettier-plugin-svelte": "^3.1.2",
|
||||||
"svelte": "^5.0.0-next.1",
|
"svelte": "^5.0.0-next.1",
|
||||||
|
"svelte-adapter-deno": "^0.9.1",
|
||||||
"svelte-check": "^4.0.0",
|
"svelte-check": "^4.0.0",
|
||||||
"typescript": "^5.0.0",
|
"typescript": "^5.0.0",
|
||||||
"typescript-eslint": "^8.0.0",
|
"typescript-eslint": "^8.0.0",
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import adapter from '@sveltejs/adapter-auto';
|
import adapter from 'svelte-adapter-deno';
|
||||||
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
|
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
|
||||||
|
|
||||||
/** @type {import('@sveltejs/kit').Config} */
|
/** @type {import('@sveltejs/kit').Config} */
|
||||||
|
@ -11,7 +11,9 @@ const config = {
|
||||||
// adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list.
|
// adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list.
|
||||||
// If your environment is not supported, or you settled on a specific environment, switch out the adapter.
|
// If your environment is not supported, or you settled on a specific environment, switch out the adapter.
|
||||||
// See https://kit.svelte.dev/docs/adapters for more information about adapters.
|
// See https://kit.svelte.dev/docs/adapters for more information about adapters.
|
||||||
adapter: adapter()
|
adapter: adapter({
|
||||||
|
out: './container/app'
|
||||||
|
})
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue