diff --git a/server/.dockerignore b/server/.dockerignore new file mode 100644 index 0000000..ee88966 --- /dev/null +++ b/server/.dockerignore @@ -0,0 +1 @@ +assets/ diff --git a/server/Dockerfile b/server/Dockerfile new file mode 100644 index 0000000..6610bbc --- /dev/null +++ b/server/Dockerfile @@ -0,0 +1,33 @@ +FROM alpine:latest AS builder + +WORKDIR /usr/local/src +COPY . . + +RUN apk add --no-cache \ + protobuf \ + protobuf-dev \ + protoc \ + make \ + go \ + libcap + +RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@latest &&\ + go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest &&\ + PATH="$PATH:$(go env GOPATH)/bin" make proto &&\ + go build -o lunar-tear ./cmd/lunar-tear &&\ + setcap cap_net_bind_service=+ep ./lunar-tear + +FROM alpine:latest + +WORKDIR /opt/lunar-tear + +RUN chown 1000:1000 /opt/lunar-tear + +USER 1000 + +COPY --from=builder /usr/local/src/lunar-tear . + +COPY entrypoint.sh . + +ENTRYPOINT /opt/lunar-tear/entrypoint.sh + diff --git a/server/docker-compose.yaml b/server/docker-compose.yaml new file mode 100644 index 0000000..e20b69b --- /dev/null +++ b/server/docker-compose.yaml @@ -0,0 +1,14 @@ +services: + server: + build: . + image: kretts/lunar-tear:latest + environment: + LUNAR_HOST: 127.0.0.1 + LUNAR_HTTP_PORT: 8080 + LUNAR_SCENE: 0 + volumes: + - ./assets:/opt/lunar-tear/assets + ports: + - 443:443 # grpc, hardcoded by the client, not configurable + - 8080:8080 + diff --git a/server/entrypoint.sh b/server/entrypoint.sh new file mode 100755 index 0000000..0b1e4bb --- /dev/null +++ b/server/entrypoint.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env sh + +./lunar-tear --host "${LUNAR_HOST}" --http-port "${LUNAR_HTTP_PORT}" --scene "${LUNAR_SCENE}" +