Added docker-compose file
This commit is contained in:
@@ -7,6 +7,6 @@ RUN make
|
|||||||
FROM debian:stable-slim AS run
|
FROM debian:stable-slim AS run
|
||||||
RUN apt-get update -y && apt-get upgrade -y && apt-get install -y libgnutls28-dev libgnutls30
|
RUN apt-get update -y && apt-get upgrade -y && apt-get install -y libgnutls28-dev libgnutls30
|
||||||
COPY --from=build /swebs/build/swebs /usr/sbin/swebs
|
COPY --from=build /swebs/build/swebs /usr/sbin/swebs
|
||||||
COPY ./site /site
|
RUN useradd -M swebs
|
||||||
|
|
||||||
ENTRYPOINT [ "swebs", "-s", "/site/sitefile" ]
|
ENTRYPOINT [ "swebs", "-s", "/site/sitefile" ]
|
||||||
|
|||||||
9
docker-compose.yml
Normal file
9
docker-compose.yml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
version: "3"
|
||||||
|
services:
|
||||||
|
swebs:
|
||||||
|
image: natechoe/swebs
|
||||||
|
ports:
|
||||||
|
- "8000:8000"
|
||||||
|
volumes:
|
||||||
|
- ./site/:/site/
|
||||||
|
working_dir: "/site/"
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
define port 8000
|
|
||||||
|
|
||||||
#define transport TLS
|
|
||||||
define key domain.key
|
|
||||||
define cert domain.crt
|
|
||||||
define timeout 2000
|
|
||||||
define library ./library.so
|
|
||||||
|
|
||||||
set host localhost:8000
|
|
||||||
read / site/index.html
|
|
||||||
read /hello site/hello.html
|
|
||||||
throw /blog/forbidden 403
|
|
||||||
read /blog/.* site/blog/
|
|
||||||
#/blog/2021-1-25.html turns into site/blog//blog/2021-1-25.html
|
|
||||||
linked /library
|
|
||||||
set host 127.0.0.1:8000
|
|
||||||
read / site/easteregg.html
|
|
||||||
read /egg.png site/egg.png
|
|
||||||
set host .*
|
|
||||||
read /alldomains site/alldomains.html
|
|
||||||
@@ -1,2 +1,5 @@
|
|||||||
This is a blog site. Ideally you wouldn't use any relative path names, but for
|
This is a blog site. Ideally you wouldn't use any relative path names, but for
|
||||||
portability reasons I'm assuming that swebs is being run in this directory.
|
portability reasons I'm assuming that swebs is being run in this directory.
|
||||||
|
|
||||||
|
Relative path names do work with docker, but relative path names scare me, and
|
||||||
|
they should scare you too.
|
||||||
|
Before Width: | Height: | Size: 7.2 KiB After Width: | Height: | Size: 7.2 KiB |
@@ -1,4 +1,20 @@
|
|||||||
define transport TCP
|
|
||||||
define port 8000
|
define port 8000
|
||||||
|
|
||||||
read .* /site/
|
#define transport TLS
|
||||||
|
define key domain.key
|
||||||
|
define cert domain.crt
|
||||||
|
define timeout 2000
|
||||||
|
define library ./library.so
|
||||||
|
|
||||||
|
set host localhost:8000
|
||||||
|
read / site/index.html
|
||||||
|
read /hello site/hello.html
|
||||||
|
throw /blog/forbidden 403
|
||||||
|
read /blog/.* site/blog/
|
||||||
|
#/blog/2021-1-25.html turns into site/blog//blog/2021-1-25.html
|
||||||
|
linked /library
|
||||||
|
set host 127.0.0.1:8000
|
||||||
|
read / site/easteregg.html
|
||||||
|
read /egg.png site/egg.png
|
||||||
|
set host .*
|
||||||
|
read /alldomains site/alldomains.html
|
||||||
|
|||||||
@@ -174,8 +174,7 @@ int main(int argc, char **argv) {
|
|||||||
int fd;
|
int fd;
|
||||||
int lowestProc;
|
int lowestProc;
|
||||||
|
|
||||||
fd = accept(listener->fd, (struct sockaddr *) &listener->addr,
|
fd = acceptConnection(listener);
|
||||||
&listener->addrlen);
|
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
if (errno == ENOTSOCK || errno == EOPNOTSUPP ||
|
if (errno == ENOTSOCK || errno == EOPNOTSUPP ||
|
||||||
errno == EINVAL) {
|
errno == EINVAL) {
|
||||||
|
|||||||
@@ -134,13 +134,13 @@ NULL
|
|||||||
}
|
}
|
||||||
|
|
||||||
*site = parseSitefile(sitefile);
|
*site = parseSitefile(sitefile);
|
||||||
if (site == NULL) {
|
if (*site == NULL) {
|
||||||
fprintf(stderr, "Invalid sitefile %s\n", sitefile);
|
fprintf(stderr, "Invalid sitefile %s\n", sitefile);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
*listener = createListener((*site)->port, backlog);
|
*listener = createListener((*site)->port, backlog);
|
||||||
if (listener == NULL) {
|
if (*listener == NULL) {
|
||||||
fprintf(stderr, "Failed to create socket\n");
|
fprintf(stderr, "Failed to create socket\n");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user