diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..4aa0571 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,5 @@ +/release +/data +/bin +/.vscode +/vendor \ No newline at end of file diff --git a/Makefile b/Makefile index 76d5aa7..374e0bd 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,13 @@ +DOKKU_HOST := dokku@dev.lookingfora.name +SHELL := /bin/bash + build: vendor CGO_ENABLED=0 go build -mod=vendor -v -o bin/server ./cmd/server test: go test -v -race ./... -release: +release: vendor @$(SHELL) ./misc/script/release.sh vendor: @@ -46,6 +49,24 @@ hydra-interactive: hydra \ /bin/sh +dokku-build: + docker build \ + -t hydra-passwordless-dokku:latest \ + . + +dokku-run: + docker run -it --rm -p 4444:4444 -p 3002:3002 hydra-passwordless-dokku:latest + +dokku-deploy: dokku-deploy-passwordless dokku-deploy-sso + +dokku-deploy-passwordless: + $(if $(shell git config remote.dokku-passwordless.url),, git remote add dokku-passwordless $(DOKKU_HOST):passwordless) + git push -f dokku-passwordless $(shell git rev-parse HEAD):refs/heads/master + +dokku-deploy-sso: + $(if $(shell git config remote.dokku-sso.url),, git remote add dokku-sso $(DOKKU_HOST):sso) + git push -f dokku-sso $(shell git rev-parse HEAD):refs/heads/master + clean: rm -rf release rm -rf data diff --git a/misc/containers/hydra/Dockerfile b/misc/containers/hydra/Dockerfile index f7eabe6..f511eae 100644 --- a/misc/containers/hydra/Dockerfile +++ b/misc/containers/hydra/Dockerfile @@ -8,9 +8,12 @@ RUN chmod a+x /usr/local/bin/docker-entrypoint COPY first-run.sh /usr/local/bin/docker-first-run RUN chmod a+x /usr/local/bin/docker-first-run +VOLUME /home/ory/.container-lifecycle + RUN mkdir -p /home/ory && chown -R ory: /home/ory USER ory ENTRYPOINT ["/usr/local/bin/docker-entrypoint"] + CMD ["hydra", "serve", "all"] \ No newline at end of file diff --git a/misc/dokku/passwordless/Dockerfile b/misc/dokku/passwordless/Dockerfile new file mode 100644 index 0000000..a58ff53 --- /dev/null +++ b/misc/dokku/passwordless/Dockerfile @@ -0,0 +1,22 @@ +FROM golang:1.13 AS build + +ARG HTTP_PROXY= +ARG HTTPS_PROXY= +ARG http_proxy= +ARG https_proxy= + +RUN apt-get update && apt-get install -y build-essential git bash + +COPY . /src + +WORKDIR /src + +RUN make ARCH_TARGETS=amd64 release + +FROM busybox + +COPY --from=build /src/release/server-linux-amd64 /app + +WORKDIR /app + +CMD ["bin/server", "-workdir", "/app", "-config", "server.yml"] \ No newline at end of file diff --git a/misc/dokku/sso/Dockerfile b/misc/dokku/sso/Dockerfile new file mode 100644 index 0000000..80e0a58 --- /dev/null +++ b/misc/dokku/sso/Dockerfile @@ -0,0 +1,19 @@ +FROM oryd/hydra:v1.4.2-alpine + +USER root + +COPY misc/containers/hydra/docker-entrypoint.sh /usr/local/bin/docker-entrypoint +RUN chmod a+x /usr/local/bin/docker-entrypoint + +COPY misc/containers/hydra/first-run.sh /usr/local/bin/docker-first-run +RUN chmod a+x /usr/local/bin/docker-first-run + +VOLUME /home/ory/.container-lifecycle + +RUN mkdir -p /home/ory && chown -R ory: /home/ory + +USER ory + +ENTRYPOINT ["/usr/local/bin/docker-entrypoint"] + +CMD ["hydra", "serve", "all"] \ No newline at end of file