graphql-engine/server/packaging/Dockerfile
José Lorenzo Rodríguez c7a2320456 Implemented graceful shutdown for HTTP requests (close #2698) (#2717)
* Listens for SIGTERM as the termination signal
* Stops accepting new connections once the signal is received
* Waits for all connections to be drained, before shutting down
* Forcefully kills all pending connections after 30 seconds

Currently this does not send a close message to websocket clients, I'd
like to submit that change as a separate pull request, but at least this
solve my biggest concern which is not getting confirmation for mutations
while restarting the server.
2019-08-26 00:31:27 -05:00

27 lines
914 B
Docker

ARG stack_resolver
ARG packager_version
# Stage 1: build the application
FROM fpco/stack-build:${stack_resolver} as builder
ARG stack_flags=""
ARG build_flags=""
ARG project="graphql-engine"
RUN mkdir /build
COPY . /build/
WORKDIR /build
RUN stack --system-ghc ${stack_flags} build ${build_flags}
RUN cp $(stack --system-ghc path --dist-dir)/build/${project}/${project} /build
# Stage 2: package the app into a busybox rootfs, strip, compress etc.
FROM hasura/graphql-engine-packager:${packager_version} as packager
ARG project="graphql-engine"
RUN mkdir -p /packaging/build/rootfs
COPY --from=builder /build/${project} /root/
RUN /build.sh ${project} | tar -xC /packaging/build/rootfs
RUN strip --strip-unneeded /packaging/build/rootfs/bin/${project}
RUN upx /packaging/build/rootfs/bin/${project}
# Stage 3: copy the rootfs into a scratch container
FROM scratch
COPY --from=packager /packaging/build/rootfs /