Skip to content

Commit

Permalink
all: support containerization
Browse files Browse the repository at this point in the history
  • Loading branch information
changkun committed Apr 5, 2020
1 parent cb32305 commit 0670169
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 10 deletions.
22 changes: 15 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
BUILD=ssaplayground.out
all:
NAME=ssaplayground
BUILD=$(NAME).out
IMAGE=$(NAME)
VERSION = $(shell git describe --always --tags)
all: clean
go build -o $(BUILD) -mod vendor
start:
./$(BUILD) -conf config/config.yaml
./$(BUILD) -conf configs/config.yaml
docker:
docker build -t ssaplayground:v0.1 -f docker/Dockerfile .
update:
docker run -itd -v ~/dev/ssaplayground/data:/app/public/buildbox -p 6789:6789 ssaplayground:v0.1
docker build -t $(IMAGE):$(VERSION) -t $(IMAGE):latest -f docker/Dockerfile .
run:
docker ps -a | grep $(NAME) && ([ $$? -eq 0 ] && (docker stop $(NAME) && docker rm -f $(NAME))) || echo "no running container."
docker run -itd -v $(shell pwd)/data:/app/public/buildbox -p 6789:6789 --name $(NAME) ssaplayground:latest
tidy-docker:
docker ps -a | grep $(NAME)
[ $$? -eq 0 ] && docker stop $(NAME) && docker rm -f $(NAME)
docker images -f "dangling=true" -q | xargs docker rmi -f
docker image prune -f
clean:
rm -rf $(BUILD)
.PHONY: all start docker update clean
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,30 @@ A tool for exploring go ssa intermediate representation.

![](./public/assets/screen.png)

## Deployment

There are two approaches to use the SSA Playground: native execution
or Docker-based deployment.

To execute natively, you can just use:

```bash
$ make
```

If you have Docker, then you can use:

```bash
$ make docker # build the docker image
$ make run # run/update for latest image
```

Then access http://localhost:6789/gossa.

## Contribution

We would love to hear your feedback. Submit [an issue](https://github.com/changkun/ssaplayground/issues/new) to tell bugs or feature requests.

## License

GNU GPLv3 © [Changkun Ou](https://changkun.de)
4 changes: 4 additions & 0 deletions configs/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
addr: localhost:6789
mode: debug
static: public
2 changes: 1 addition & 1 deletion config/config.yaml → configs/docker.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
addr: 0.0.0.0:6789
mode: debug
mode: release
static: public
9 changes: 7 additions & 2 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
FROM alpine:latest

FROM golang:1.14-alpine
WORKDIR /app
ADD . /app
RUN go get -u golang.org/x/tools/cmd/goimports && go mod tidy
RUN go build -o ssaplayground.service -mod vendor
EXPOSE 6789
ENTRYPOINT [ "/app/ssaplayground.service", "-conf=/app/configs/docker.yaml"]
Binary file modified public/assets/screen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file removed public/buildbox/.gitkeep
Empty file.
1 change: 1 addition & 0 deletions public/buildbox/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!-- this is intended for empty -->

0 comments on commit 0670169

Please sign in to comment.