Skip to content

Commit

Permalink
Added example/Dockerfile.hello
Browse files Browse the repository at this point in the history
  • Loading branch information
yhirose committed Jan 11, 2022
1 parent 11e02e9 commit 412ab5f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
12 changes: 12 additions & 0 deletions example/Dockerfile.hello
Original file line number Diff line number Diff line change
@@ -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"]
2 changes: 1 addition & 1 deletion example/Makefile
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
2 changes: 1 addition & 1 deletion example/hello.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

0 comments on commit 412ab5f

Please sign in to comment.