bind to all addresses and drop privileges
This commit is contained in:
parent
c1c8747136
commit
7147315b04
2 changed files with 6 additions and 2 deletions
|
@ -2,6 +2,10 @@ FROM dlang2/dmd-ubuntu
|
||||||
WORKDIR /dlang/vibe-docker
|
WORKDIR /dlang/vibe-docker
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
|
RUN useradd --user-group --create-home --shell /bin/false app
|
||||||
|
RUN chown -R app:app /dlang/vibe-docker
|
||||||
|
USER app
|
||||||
|
|
||||||
RUN dub build -v
|
RUN dub build -v
|
||||||
|
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
|
|
|
@ -4,14 +4,14 @@ void main()
|
||||||
{
|
{
|
||||||
auto settings = new HTTPServerSettings;
|
auto settings = new HTTPServerSettings;
|
||||||
settings.port = 8080;
|
settings.port = 8080;
|
||||||
settings.bindAddresses = ["::1", "127.0.0.1"];
|
settings.bindAddresses = ["::", "0.0.0.0"];
|
||||||
listenHTTP(settings, &hello);
|
listenHTTP(settings, &hello);
|
||||||
|
|
||||||
logInfo("Please open http://127.0.0.1:8080/ in your browser.");
|
logInfo("Please open http://127.0.0.1:8080/ in your browser.");
|
||||||
runApplication();
|
runApplication();
|
||||||
}
|
}
|
||||||
|
|
||||||
void hello(HTTPServerRequest req, HTTPServerResponse res)
|
void hello(HTTPServerRequest, HTTPServerResponse res)
|
||||||
{
|
{
|
||||||
res.writeBody("Hello, World!");
|
res.writeBody("Hello, World!");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue