Dokku deployment recipe

This commit is contained in:
wpetit 2020-05-20 14:07:58 +02:00
parent 523ce77a84
commit a6ffc639a1
5 changed files with 71 additions and 1 deletions

5
.dockerignore Normal file
View File

@ -0,0 +1,5 @@
/release
/data
/bin
/.vscode
/vendor

View File

@ -1,10 +1,13 @@
DOKKU_HOST := dokku@dev.lookingfora.name
SHELL := /bin/bash
build: vendor build: vendor
CGO_ENABLED=0 go build -mod=vendor -v -o bin/server ./cmd/server CGO_ENABLED=0 go build -mod=vendor -v -o bin/server ./cmd/server
test: test:
go test -v -race ./... go test -v -race ./...
release: release: vendor
@$(SHELL) ./misc/script/release.sh @$(SHELL) ./misc/script/release.sh
vendor: vendor:
@ -46,6 +49,24 @@ hydra-interactive:
hydra \ hydra \
/bin/sh /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: clean:
rm -rf release rm -rf release
rm -rf data rm -rf data

View File

@ -8,9 +8,12 @@ RUN chmod a+x /usr/local/bin/docker-entrypoint
COPY first-run.sh /usr/local/bin/docker-first-run COPY first-run.sh /usr/local/bin/docker-first-run
RUN chmod a+x /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 RUN mkdir -p /home/ory && chown -R ory: /home/ory
USER ory USER ory
ENTRYPOINT ["/usr/local/bin/docker-entrypoint"] ENTRYPOINT ["/usr/local/bin/docker-entrypoint"]
CMD ["hydra", "serve", "all"] CMD ["hydra", "serve", "all"]

View File

@ -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"]

19
misc/dokku/sso/Dockerfile Normal file
View File

@ -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"]