mirror of
https://github.com/ddworken/hishtory.git
synced 2025-06-19 19:37:59 +02:00
Use wait-for instead of a sleep for the dockerfile for self hosting
This commit is contained in:
parent
9ddae45b03
commit
c2802f40dc
@ -1,7 +1,7 @@
|
||||
# A docker-compose file to host a hiSHtory backend. To use:
|
||||
# 1. Update TODO_YOUR_POSTGRES_PASSWORD_HERE
|
||||
# 2. `docker compose -f backend/server/docker-compose.yml build`
|
||||
# 3. `docker compose -f backend/server/docker-compose.yml up`
|
||||
# 3. `docker compose -f backend/server/docker-compose.yml up`
|
||||
# 4. Point your hiSHtory client at the server by putting `export HISHTORY_SERVER=http://1.2.3.4` in your shellrc
|
||||
# 5. Run `hishtory init` to initialize hiSHtory with the local server
|
||||
# 6. [Optional, but recommended] Add a TLS proxy to enable https
|
||||
|
@ -1,3 +1,6 @@
|
||||
# A fork of Dockerfile that doesn't hard code GOARCH and that uses wait-for to wait
|
||||
# until the postgres server is up. Meant to be used in the docker-compose file for self hosting.
|
||||
|
||||
FROM golang:1.18 AS builder
|
||||
COPY go.mod ./
|
||||
COPY go.sum ./
|
||||
@ -6,6 +9,9 @@ COPY . ./
|
||||
RUN unset GOPATH; go build -o /server -ldflags "-X main.ReleaseVersion=v0.`cat VERSION`" backend/server/server.go
|
||||
|
||||
FROM golang:1.18
|
||||
RUN apt-get update && apt-get install -y netcat
|
||||
# Downlaod wait-for from a specific commit hash. This ensures that the owner of wait-for isn't in our TCB (though Github still is)
|
||||
RUN curl https://raw.githubusercontent.com/eficode/wait-for/59bec22851ba83e9cc735a67a7d961f8aae2cd85/wait-for > /wait-for
|
||||
RUN chmod +x /wait-for
|
||||
COPY --from=builder /server /server
|
||||
# TODO: use wait-for-it.sh instead of a janky sleep
|
||||
CMD ["sh", "-c", "sleep 5; /server"]
|
||||
CMD ["/wait-for", "postgres:5432", "--", "/server"]
|
||||
|
Loading…
x
Reference in New Issue
Block a user