diff --git a/example/Dockerfile.hello b/example/Dockerfile.hello new file mode 100644 index 0000000000..334b0cda9c --- /dev/null +++ b/example/Dockerfile.hello @@ -0,0 +1,12 @@ +From alpine as builder +WORKDIR /src/example +RUN apk add g++ make openssl-dev zlib-dev brotli-dev +COPY ./httplib.h /src +COPY ./example/hello.cc /src/example +COPY ./example/Makefile /src/example +RUN make hello + +From alpine +RUN apk --no-cache add brotli libstdc++ +COPY --from=builder /src/example/hello /bin/hello +CMD ["/bin/hello"] diff --git a/example/Makefile b/example/Makefile index f4c86ebe61..f37cc2464b 100644 --- a/example/Makefile +++ b/example/Makefile @@ -1,5 +1,5 @@ #CXX = clang++ -CXXFLAGS = -std=c++11 -I.. -Wall -Wextra -pthread +CXXFLAGS = -O2 -std=c++11 -I.. -Wall -Wextra -pthread PREFIX = /usr/local #PREFIX = $(shell brew --prefix) diff --git a/example/hello.cc b/example/hello.cc index 1590302807..38d25a62b8 100644 --- a/example/hello.cc +++ b/example/hello.cc @@ -15,5 +15,5 @@ int main(void) { res.set_content("Hello World!", "text/plain"); }); - svr.listen("localhost", 8080); + svr.listen("0.0.0.0", 8080); }