Skip to content

Commit

Permalink
[DEV-1074] Impove docker-compose
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Nikitin <andrew.nikitin@cheqd.io>
  • Loading branch information
Andrew Nikitin committed Apr 14, 2022
1 parent d4c23e4 commit 9673e94
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 0 deletions.
12 changes: 12 additions & 0 deletions docker/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Port which will be used for incoming requests on resolver side
RESOLVER_PORT="1313"

# Drivers port for application side.
# For example, if you application will send requests to http://localhost/
# then port should be 80
REDIRECTED_PORT="80"

LOCAL_REDIRECT_FROM=localhost:80

# Address with port of external DID-Resolver.
EXTERNAL_REDIRECT_TO=http://localhost:1313
34 changes: 34 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
###############################################################
### STAGE 1: Build did-resolver binary pre-requisites ###
###############################################################

FROM golang:1.17.8-buster as builder

WORKDIR /root

COPY types ./types
COPY services ./services
COPY go.mod .
COPY go.sum .
COPY main.go .

RUN ls -la
# 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 /root/did-resolver /bin

# Copy base config.yml
WORKDIR /root

EXPOSE 1313
ENTRYPOINT ["did-resolver"]
32 changes: 32 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
version: '3.7'


services:
did_resolver:
build:
dockerfile: docker/Dockerfile
context: ../
configs:
- source: config
target: /root/config.yml
expose:
- ${RESOLVER_PORT}
ports:
- "${RESOLVER_PORT}:${RESOLVER_PORT}"
profiles:
- resolver

redirect:
image: morbz/docker-web-redirect
restart: always
ports:
- "${REDIRECTED_PORT}:${REDIRECTED_PORT}"
environment:
- VIRTUAL_HOST={LOCAL_REDIRECT_FROM}
- REDIRECT_TARGET=${EXTERNAL_REDIRECT_TO}
profiles:
- driver

configs:
config:
file: ../config.yml

0 comments on commit 9673e94

Please sign in to comment.