diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..47eec278 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,35 @@ +############################################################### +### STAGE 1: Build did-resolver binary pre-requisites ### +############################################################### + +FROM golang:1.17.8-buster as builder + +WORKDIR / + +COPY types /types +COPY services /services +COPY go.mod / +COPY go.sum / +COPY main.go /main.go + +# Make did-resolver binary +RUN go build -o did-resolver main.go + +############################################################### +### STAGE 2: Build did-resolver runner ### +############################################################### + +FROM ubuntu:focal AS runner +LABEL org.opencontainers.image.description "Cheqd DID-Resolver runner" +LABEL org.opencontainers.image.source "https://github.com/cheqd/cheqd-did-resolver" + +# Copy compiled did-resolver binary from Stage 1 +COPY --from=builder /did-resolver /bin + +# Copy base config.yml +WORKDIR /root +COPY config.yml /root + +# +EXPOSE 1313 +ENTRYPOINT ["did-resolver"] \ No newline at end of file diff --git a/config.yml b/config.yml index 31a8c81f..ef2c87b1 100644 --- a/config.yml +++ b/config.yml @@ -1,4 +1,4 @@ networks: mainnet: rpc.cheqd.net:443 - testnet: 127.0.0.1:9090 - # testnet: api.testnet.cheqd.network:443 \ No newline at end of file + #testnet: 127.0.0.1:9090 + testnet: 159.89.208.88:443 \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..f952a0e8 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,33 @@ +version: '3.7' + + +services: + did_resolver: + build: + dockerfile: Dockerfile + user: root + configs: + - source: config + target: /root/config.yml + expose: + - ${RESOLVER_PORT:-1313} + - 9090 + ports: + - "${RESOLVER_PORT:-1313}:${RESOLVER_PORT:-1313}" + profiles: + - resolver + + redirect: + image: morbz/docker-web-redirect + restart: always + ports: + - "${REDIRECTED_PORT:-80}:${REDIRECTED_PORT:-80}" + environment: + - VIRTUAL_HOST=localhost:80 + - REDIRECT_TARGET=${CHEQD_RESOLVER_PATH:-http://localhost:1313} + profiles: + - driver + +configs: + config: + file: config.yml \ No newline at end of file