dockyfied dockyfied

This commit is contained in:
Robin Bärtschi 2025-02-13 17:18:47 +01:00
parent 47453b8a02
commit 6476d54164
6 changed files with 17 additions and 9 deletions

View File

@ -13,3 +13,4 @@ helm-charts
.editorconfig .editorconfig
.idea .idea
coverage* coverage*
build

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
# deps # deps
node_modules/ node_modules/
build/

View File

@ -21,18 +21,18 @@ FROM base AS prerelease
COPY --from=install /temp/dev/node_modules node_modules COPY --from=install /temp/dev/node_modules node_modules
COPY . . COPY . .
# [optional] tests & build
ENV NODE_ENV=production ENV NODE_ENV=production
RUN bun test
RUN bun run build RUN bun run build
# copy production dependencies and source code into final image # copy production dependencies and source code into final image
FROM base AS release FROM base AS release
COPY --from=install /temp/prod/node_modules node_modules # COPY --from=install /temp/prod/node_modules node_modules
COPY --from=prerelease /usr/src/app/index.ts . # COPY --from=prerelease /usr/src/app/index.ts .
COPY --from=prerelease /usr/src/app/package.json . COPY --from=prerelease /usr/src/app/package.json .
COPY --from=prerelease /usr/src/app/build/ .
COPY --from=prerelease /usr/src/app/static/ ./static
# run the app # run the app
USER bun USER bun
EXPOSE 3000/tcp EXPOSE 3000
ENTRYPOINT [ "bun", "run", "index.ts" ] ENTRYPOINT [ "bun", "run", "index.js" ]

5
docker-compose.yml Normal file
View File

@ -0,0 +1,5 @@
services:
dockyfied:
build: .
ports:
- "3000:3000"

View File

@ -1,7 +1,8 @@
{ {
"name": "dockyfied", "name": "dockyfied",
"scripts": { "scripts": {
"dev": "bun run --watch src/index.tsx" "dev": "bun run --watch src/index.tsx",
"build": "bun build src/index.tsx --outdir ./build --splitting"
}, },
"dependencies": { "dependencies": {
"hono": "^4.7.1" "hono": "^4.7.1"

View File

@ -4,7 +4,7 @@ import { logger } from 'hono/logger';
import BaseDocument from './BaseDocument'; import BaseDocument from './BaseDocument';
function ImageButton() { function ImageButton() {
return <button hx-get='/image' hx-target='this' hx-swap="outerHTML">See Image</button>; return <button hx-get='/image' hx-target='this' hx-swap="outerHTML">See Meme</button>;
} }
const app = new Hono(); const app = new Hono();
@ -31,7 +31,7 @@ app.get(
<p>&uarr;</p> <p>&uarr;</p>
<p>Click the image above to replace with the button again.</p> <p>Click the image above to replace with the button again.</p>
<br /> <br />
<p id='secret' hx-swap='outerHTML' hx-get='/image2'>Another image?</p> <p id='secret' hx-swap='outerHTML' hx-get='/image2'>Another Meme?</p>
</div> </div>
); );
} }