diff --git a/deployments/docker/mita-amd64/conf/config.json b/deployments/docker/mita-amd64/conf/config.json new file mode 100644 index 00000000..d64b3204 --- /dev/null +++ b/deployments/docker/mita-amd64/conf/config.json @@ -0,0 +1,16 @@ +{ + "portBindings": [ + { + "portRange": "27017-27019", + "protocol": "UDP" + } + ], + "users": [ + { + "name": "uname1", + "password": "pwd1" + } + ], + "loggingLevel": "INFO", + "mtu": 1400 +} diff --git a/deployments/docker/mita-amd64/docker-compose.yml b/deployments/docker/mita-amd64/docker-compose.yml new file mode 100644 index 00000000..37274fcd --- /dev/null +++ b/deployments/docker/mita-amd64/docker-compose.yml @@ -0,0 +1,16 @@ +services: + mita: + build: . + image: mita + container_name: mita + stop_grace_period: 5s + restart: always + logging: + driver: json-file + options: + max-size: 10m + max-file: 10 + ports: + - 27017-27019:27017-27019/udp + environment: + - TZ=Asia/Shanghai diff --git a/deployments/docker/mita-amd64/dockerfile b/deployments/docker/mita-amd64/dockerfile new file mode 100644 index 00000000..c8b97c45 --- /dev/null +++ b/deployments/docker/mita-amd64/dockerfile @@ -0,0 +1,22 @@ +FROM golang:1.20-alpine AS builder + +RUN apk update && apk add --no-cache git + +RUN git clone https://github.com/enfein/mieru.git /build + +WORKDIR /build + +RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="-s -w" -o mita cmd/mita/mita.go + + +FROM alpine AS base + +COPY --from=builder /build/mita /usr/local/bin/ + +WORKDIR /app + +COPY . . + +RUN chmod +x ./start.sh && adduser -H -D -g "" mita && mkdir -p /etc/mita + +CMD ["./start.sh"] \ No newline at end of file diff --git a/deployments/docker/mita-amd64/start.sh b/deployments/docker/mita-amd64/start.sh new file mode 100644 index 00000000..a08fd87d --- /dev/null +++ b/deployments/docker/mita-amd64/start.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +set -e + +mita run & +sleep 2 + +mita apply config ./conf/config.json + +mita start + +mita describe config + +wait -n