Skip to content

Commit

Permalink
Use the default honeybee private key file in the container if not spe…
Browse files Browse the repository at this point in the history
…cified
  • Loading branch information
ish-hcc committed Aug 22, 2024
1 parent e838c0c commit 6c39bba
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,14 @@ RUN apk --no-cache add tzdata
RUN echo "Asia/Seoul" > /etc/timezone
RUN cp -f /usr/share/zoneinfo/Asia/Seoul /etc/localtime

RUN apk --no-cache add ansible
RUN apk --no-cache add ansible curl

COPY --from=builder /go/src/github.com/cloud-barista/cm-grasshopper/conf /conf
COPY --from=builder /go/src/github.com/cloud-barista/cm-grasshopper/cmd/cm-grasshopper/cm-grasshopper /cm-grasshopper

RUN mkdir -p /root/.cm-grasshopper/
RUN curl --ipv4 https://raw.githubusercontent.com/cloud-barista/cm-honeybee/main/server/_default_key/honeybee.key -o /root/.cm-grasshopper/honeybee.key

USER root
CMD ["/cm-grasshopper"]

Expand Down
3 changes: 0 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,6 @@ run_docker: ## Run the built binary within Docker
GIT_HASH_MINE=`git rev-parse HEAD` && \
GIT_HASH_LAST_BUILD=`cat .git_hash_last_build 2>&1 > /dev/null | true` && \
if [ "$$STATUS" != "0" ] || [ "$$GIT_HASH_MINE" != "$$GIT_HASH_LAST_BUILD" ]; then \
if [ ! -f "./honeybee.key" ]; then \
docker cp cm-honeybee:/root/.cm-honeybee/honeybee.key .; \
fi && \
docker rmi -f cm-grasshopper:latest; \
fi
@docker compose up -d
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ Or, you can run it within Docker by this command.
make run_docker
```

Docker container will use the default honeybee private key file.
To use the copied honeybee private key file, uncomment it below in the `docker-compose.yaml` file.
```shell
#- ./honeybee.key:/root/.cm-grasshopper/honeybee.key:ro
```

### Health-check

Check if CM-Grasshopper is running
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ services:
image: cm-grasshopper:${TAG:-latest}
volumes:
#- ./CM-GRASSHOPPER.db:/CM-GRASSHOPPER.db:rw
- ./honeybee.key:/root/.cm-grasshopper/honeybee.key:ro
#- ./honeybee.key:/root/.cm-grasshopper/honeybee.key:ro
- ./software_temp:/software_temp:rw
- ./software_log:/software_log:rw
- ./playbook:/playbook/:rw
Expand Down

0 comments on commit 6c39bba

Please sign in to comment.