feat: add typesense Dockerfile

This commit is contained in:
2025-07-16 19:22:37 -05:00
parent 64f847ecdd
commit 0a846341e4
5 changed files with 54 additions and 0 deletions
+15
View File
@@ -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
}
+22
View File
@@ -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"]
+9
View File
@@ -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
+4
View File
@@ -0,0 +1,4 @@
#!/bin/sh
# replace process with caddy, redirect stderr to stdout
exec caddy run --config Caddyfile --adapter caddyfile 2>&1
+4
View File
@@ -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