Fix hostname binding and add healthcheck to docker
This commit is contained in:
parent
673c344ff4
commit
09bc9c6b42
4 changed files with 9 additions and 10 deletions
|
@ -1,11 +1,13 @@
|
||||||
|
|
||||||
FROM oven/bun:alpine
|
FROM oven/bun:alpine
|
||||||
|
|
||||||
|
ENV HOSTNAME localhost
|
||||||
|
|
||||||
WORKDIR /startpage
|
WORKDIR /startpage
|
||||||
|
|
||||||
COPY assets ./assets
|
COPY assets ./assets
|
||||||
COPY src ./src
|
COPY src ./src
|
||||||
|
COPY package.json ./
|
||||||
|
|
||||||
EXPOSE 8080/tcp
|
HEALTHCHECK --interval=5s --timeout=5s --retries=3 CMD wget --spider -q http://0.0.0.0/healthcheck || exit 1
|
||||||
|
|
||||||
ENTRYPOINT [ "bun", "run", "./src/index.ts" ]
|
ENTRYPOINT [ "bun", "start" ]
|
||||||
|
|
|
@ -4,6 +4,4 @@ services:
|
||||||
build: .
|
build: .
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
ports:
|
ports:
|
||||||
- "8080:8080"
|
- "8080:80"
|
||||||
environment:
|
|
||||||
PORT: 8080
|
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
"name": "startpage",
|
"name": "startpage",
|
||||||
"module": "./src/index.ts",
|
"module": "./src/index.ts",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"script": {
|
"scripts": {
|
||||||
"start": "bun run index.ts"
|
"start": "bun run ./src/index.ts"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"bun-types": "^1.1.31"
|
"bun-types": "^1.1.31"
|
||||||
|
|
|
@ -16,9 +16,8 @@ const fetch = (req: Request) => {
|
||||||
|
|
||||||
Bun.serve({
|
Bun.serve({
|
||||||
port: Bun.env.PORT || 80,
|
port: Bun.env.PORT || 80,
|
||||||
hostname: Bun.env.HOSTNAME || "localhost",
|
|
||||||
static: {
|
static: {
|
||||||
"/api/healthcheck": new Response("All good!"),
|
"/healthcheck": new Response("All good!"),
|
||||||
"/": new Response(await Bun.file("./src/index.html").bytes(), {
|
"/": new Response(await Bun.file("./src/index.html").bytes(), {
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "text/html",
|
"Content-Type": "text/html",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue