Skip to content
This repository was archived by the owner on Jan 23, 2022. It is now read-only.

Commit

Permalink
Add docker support
Browse files Browse the repository at this point in the history
Closes #1
  • Loading branch information
ilyaglow committed Mar 29, 2018
1 parent b7f24b9 commit 8b5208f
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 0 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,15 @@ Usage of dor-web-inmemory:
Port to bind (default "8080")
```

## Docker usage

Project has [docker-compose](docker-compose.yml) that uses MongoDB as a storage. Make changes here accordingly if any (folder for data persistence, ports etc).

```
docker-compose up -d
```


## Client usage

```
Expand Down
23 changes: 23 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
version: "2"
services:
web:
build:
context: .
dockerfile: docker/Dockerfile.web-mongo
ports:
- "8080:8080"
environment:
DOR_MONGO_URL: "mongo"
DOR_PORT: "8080"

insert:
build:
context: .
dockerfile: docker/Dockerfile.insert-mongo
environment:
DOR_MONGO_URL: "mongo"

mongo:
image: mongo:latest
volumes:
- ./mongodata:/data/db
28 changes: 28 additions & 0 deletions docker/Dockerfile.insert-mongo
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
FROM golang:alpine AS build-env
LABEL maintainer "Ilya Glotov <[email protected]>"
LABEL repository "https://github.com/ilyaglow/dor"

ENV CGO_ENABLED 0

RUN apk -U --no-cache add git

WORKDIR /go/src/github.com/ilyaglow/dor

COPY . .

RUN go get -d -v ./... \
&& cd cmd/dor-insert-mongo/ \
&& go build -ldflags="-s -w" -a -installsuffix cgo -o /tmp/dor-insert

RUN chmod +x /tmp/dor-insert

FROM alpine:edge

RUN apk -U --no-cache add ca-certificates \
&& adduser -D app

COPY --from=build-env /tmp/dor-insert /dor-insert

USER app

ENTRYPOINT ["/dor-insert"]
28 changes: 28 additions & 0 deletions docker/Dockerfile.web-mongo
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
FROM golang:alpine AS build-env
LABEL maintainer "Ilya Glotov <[email protected]>"
LABEL repository "https://github.com/ilyaglow/dor"

ENV CGO_ENABLED 0

RUN apk -U --no-cache add git

WORKDIR /go/src/github.com/ilyaglow/dor

COPY . .

RUN go get -d -v ./... \
&& cd service/dor-web-mongodb \
&& go build -ldflags="-s -w" -a -installsuffix cgo -o /tmp/dor

RUN chmod +x /tmp/dor

FROM alpine:edge

RUN apk -U --no-cache add ca-certificates \
&& adduser -D app

COPY --from=build-env /tmp/dor /dor

USER app

ENTRYPOINT ["/dor"]

0 comments on commit 8b5208f

Please sign in to comment.