Preliminary nodejs support

This commit is contained in:
Ben Allfree 2023-12-17 04:37:32 -08:00
parent fa0d4a7a5b
commit 584ef0a89a
3 changed files with 34 additions and 3 deletions

View File

@ -1,6 +1,8 @@
FROM alpine:3.18
FROM node:20-alpine3.18
RUN apk update && apk add ca-certificates && rm -rf /var/cache/apk/*
RUN apk update
RUN apk add --no-cache ca-certificates bash
RUN npm i -g pnpm
RUN adduser -D pocketbase

View File

@ -1,4 +1,4 @@
import { APEX_DOMAIN, mkInstanceDataPath } from '$constants'
import { APEX_DOMAIN, PH_PROJECT_ROOT, mkInstanceDataPath } from '$constants'
import { InstanceLogger, PortService } from '$services'
import {
LoggerService,
@ -12,6 +12,7 @@ import { map } from '@s-libs/micro-dash'
import Docker, { Container, ContainerCreateOptions } from 'dockerode'
import { existsSync } from 'fs'
import MemoryStream from 'memorystream'
import { join } from 'path'
import { AsyncReturnType } from 'type-fest'
import { PocketbaseReleaseVersionService } from '../PocketbaseReleaseVersionService'
import { buildImage } from './buildImage'
@ -121,6 +122,15 @@ export const createPocketbaseService = async (
stderr.on('data', _stdErrData)
const Binds = [`${mkInstanceDataPath(slug)}:/home/pocketbase`]
Binds.push(`${binPath}:/home/pocketbase/pocketbase:ro`)
Binds.push(
`${join(
PH_PROJECT_ROOT(),
'src',
'services',
'PocketBaseService',
`run.sh`,
)}:/home/pocketbase/run.sh:ro`,
)
if (extraBinds.length > 0) {
Binds.push(...extraBinds)

View File

@ -0,0 +1,19 @@
#!/bim/bash
./pocketbase serve --http 0.0.0.0:8090 &
pid1=$!
# Start the second process in the background
# process2 &
# pid2=$!
# Wait for either process to exit
wait -n
exit_status=$?
# Kill the remaining process (if any)
kill $pid1 2>/dev/null
kill $pid2 2>/dev/null
# Exit with the captured exit status
exit $exit_status