mirror of
https://github.com/ddworken/hishtory.git
synced 2024-11-23 08:45:16 +01:00
18 lines
830 B
Plaintext
18 lines
830 B
Plaintext
# 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 ./
|
|
RUN unset GOPATH; go mod download
|
|
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
|
|
CMD ["/wait-for", "postgres:5432", "--", "/server"]
|