Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DEV-1074] Make a dockerfile for did-resolver #2

Merged
merged 4 commits into from
Apr 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
4 changes: 2 additions & 2 deletions config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
networks:
mainnet: rpc.cheqd.net:443
testnet: 127.0.0.1:9090
# testnet: api.testnet.cheqd.network:443
#testnet: 127.0.0.1:9090
testnet: 159.89.208.88:443
33 changes: 33 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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