Added docker
This commit is contained in:
28
.github/workflows/docker.yml
vendored
Normal file
28
.github/workflows/docker.yml
vendored
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
name: Docker Hub
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ master ]
|
||||||
|
pull_request:
|
||||||
|
branches: [ master ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Set login
|
||||||
|
uses: azure/docker-login@v1
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.REGISTRY_USERNAME }}
|
||||||
|
password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Build image
|
||||||
|
working-directory: ${{github.workspace}}
|
||||||
|
run: ./build.sh
|
||||||
|
|
||||||
|
- name: Push image
|
||||||
|
run: docker push natechoe/swebs
|
||||||
12
Dockerfile
Normal file
12
Dockerfile
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
FROM debian:stable-slim AS build
|
||||||
|
RUN apt-get update -y && apt-get upgrade -y && apt-get install -y libgnutls28-dev libgnutls30 gcc make pkg-config
|
||||||
|
COPY . /swebs
|
||||||
|
WORKDIR /swebs
|
||||||
|
RUN make
|
||||||
|
|
||||||
|
FROM debian:stable-slim AS run
|
||||||
|
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 ./site /site
|
||||||
|
|
||||||
|
ENTRYPOINT [ "swebs", "-s", "/site/sitefile" ]
|
||||||
4
site/sitefile
Normal file
4
site/sitefile
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
define transport TCP
|
||||||
|
define port 8000
|
||||||
|
|
||||||
|
read .* /site/
|
||||||
@@ -16,6 +16,8 @@
|
|||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <features.h>
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@@ -29,6 +31,9 @@
|
|||||||
#include <swebs/responses.h>
|
#include <swebs/responses.h>
|
||||||
#include <swebs/responseutil.h>
|
#include <swebs/responseutil.h>
|
||||||
|
|
||||||
|
char *realpath(char *, char *);
|
||||||
|
/* I don't know why, but realpath breaks on debian. */
|
||||||
|
|
||||||
static int readResponse(Connection *conn, char *path) {
|
static int readResponse(Connection *conn, char *path) {
|
||||||
int fd = -1;
|
int fd = -1;
|
||||||
struct stat statbuf;
|
struct stat statbuf;
|
||||||
|
|||||||
Reference in New Issue
Block a user