mirror of
https://github.com/Xevion/the-office.git
synced 2026-01-31 00:26:07 -06:00
feat: add typesense Dockerfile
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
# global options
|
||||
{
|
||||
admin off # theres no need for the admin api in railway's environment
|
||||
persist_config off # storage isn't persistent anyway
|
||||
auto_https off # railway handles https for us, this could in some cases cause issues if left enabled
|
||||
# runtime logs
|
||||
log {
|
||||
output discard # theres no need for caddy's runtime logs
|
||||
}
|
||||
}
|
||||
|
||||
# site block, listens on the $PORT environment variable, automatically assigned by railway
|
||||
:{$PORT} {
|
||||
reverse_proxy http://127.0.0.1:8118
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
FROM alpine:latest AS parallel
|
||||
|
||||
# install 'parallel' for entrypoint script
|
||||
RUN apk add --no-cache parallel
|
||||
|
||||
FROM caddy:latest AS caddy
|
||||
|
||||
# format caddyfile, image contains caddy binary
|
||||
COPY Caddyfile ./
|
||||
RUN caddy fmt --overwrite Caddyfile
|
||||
|
||||
FROM typesense/typesense:29.0
|
||||
|
||||
# copy caddyfile, caddy binary, parallel binary, and scripts from previous layers
|
||||
COPY --from=caddy /srv/Caddyfile ./
|
||||
COPY --from=caddy /usr/bin/caddy /usr/bin/caddy
|
||||
COPY --from=parallel /usr/bin/parallel /usr/bin/parallel
|
||||
COPY --chmod=755 scripts/* ./
|
||||
|
||||
# run start.sh script
|
||||
ENTRYPOINT ["/bin/sh"]
|
||||
CMD ["start.sh"]
|
||||
@@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
|
||||
# exit as soon as a single command finishes (any status), kill the rest
|
||||
parallel --ungroup --halt now,done=1 ::: \
|
||||
"./start_caddy.sh" \
|
||||
"./start_typesense.sh"
|
||||
|
||||
# always exit with a failure status
|
||||
false
|
||||
@@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
|
||||
# replace process with caddy, redirect stderr to stdout
|
||||
exec caddy run --config Caddyfile --adapter caddyfile 2>&1
|
||||
@@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
|
||||
# replace process with server, always use 8118 port internally, caddy will proxy the railway-assigned port, localhost listen
|
||||
exec /opt/typesense-server --api-address 127.0.0.1 --api-port 8118
|
||||
Reference in New Issue
Block a user