From c6ac3344291cff8b2ad6f6793e21e278cb64fa6c Mon Sep 17 00:00:00 2001 From: Naoki Kosaka Date: Wed, 7 Nov 2018 02:41:11 +0900 Subject: [PATCH] Add Docker support. --- Dockerfile | 17 +++++++++++++++++ docker-compose.yml | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ccfbf76 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,17 @@ +FROM golang:alpine AS build + +WORKDIR /go/src/github.com/yukimochi/Activity-Relay +COPY . /go/src/github.com/yukimochi/Activity-Relay + +RUN mkdir -p /rootfs/usr/bin && \ + apk add -U --no-cache git && \ + go get -u github.com/golang/dep/cmd/dep && \ + dep ensure && \ + go build -o /rootfs/usr/bin/server . && \ + go build -o /rootfs/usr/bin/worker ./worker + +FROM alpine + +COPY --from=build /rootfs/usr/bin /usr/bin +RUN chmod +x /usr/bin/server /usr/bin/worker && \ + apk add -U --no-cache ca-certificates diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..b6077c9 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,32 @@ +version: "2.3" +services: + redis: + restart: always + image: redis:alpine + + worker: + build: . + image: yukimochi/activity-relay + restart: always + init: true + command: worker + environment: + - "ACTOR_PEM=/actor.pem" + - "RELAY_DOMAIN=relay.toot.yukimochi.jp" + - "REDIS_URL=redis:6379" + volumes: + - "./actor.pem:/actor.pem" + + server: + build: . + image: yukimochi/activity-relay + restart: always + init: true + command: server + environment: + - "ACTOR_PEM=/actor.pem" + - "RELAY_DOMAIN=relay.toot.yukimochi.jp" + - "RELAY_BIND=0.0.0.0:8080" + - "REDIS_URL=redis:6379" + volumes: + - "./actor.pem:/actor.pem"