Skip to content

Commit 0670169

Browse files
committed
all: support containerization
1 parent cb32305 commit 0670169

File tree

8 files changed

+52
-10
lines changed

8 files changed

+52
-10
lines changed

Makefile

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
1-
BUILD=ssaplayground.out
2-
all:
1+
NAME=ssaplayground
2+
BUILD=$(NAME).out
3+
IMAGE=$(NAME)
4+
VERSION = $(shell git describe --always --tags)
5+
all: clean
36
go build -o $(BUILD) -mod vendor
4-
start:
5-
./$(BUILD) -conf config/config.yaml
7+
./$(BUILD) -conf configs/config.yaml
68
docker:
7-
docker build -t ssaplayground:v0.1 -f docker/Dockerfile .
8-
update:
9-
docker run -itd -v ~/dev/ssaplayground/data:/app/public/buildbox -p 6789:6789 ssaplayground:v0.1
9+
docker build -t $(IMAGE):$(VERSION) -t $(IMAGE):latest -f docker/Dockerfile .
10+
run:
11+
docker ps -a | grep $(NAME) && ([ $$? -eq 0 ] && (docker stop $(NAME) && docker rm -f $(NAME))) || echo "no running container."
12+
docker run -itd -v $(shell pwd)/data:/app/public/buildbox -p 6789:6789 --name $(NAME) ssaplayground:latest
13+
tidy-docker:
14+
docker ps -a | grep $(NAME)
15+
[ $$? -eq 0 ] && docker stop $(NAME) && docker rm -f $(NAME)
16+
docker images -f "dangling=true" -q | xargs docker rmi -f
17+
docker image prune -f
1018
clean:
1119
rm -rf $(BUILD)
1220
.PHONY: all start docker update clean

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,30 @@ A tool for exploring go ssa intermediate representation.
66

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

9+
## Deployment
10+
11+
There are two approaches to use the SSA Playground: native execution
12+
or Docker-based deployment.
13+
14+
To execute natively, you can just use:
15+
16+
```bash
17+
$ make
18+
```
19+
20+
If you have Docker, then you can use:
21+
22+
```bash
23+
$ make docker # build the docker image
24+
$ make run # run/update for latest image
25+
```
26+
27+
Then access http://localhost:6789/gossa.
28+
29+
## Contribution
30+
31+
We would love to hear your feedback. Submit [an issue](https://github.com/changkun/ssaplayground/issues/new) to tell bugs or feature requests.
32+
933
## License
1034

1135
GNU GPLv3 © [Changkun Ou](https://changkun.de)

configs/config.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
addr: localhost:6789
3+
mode: debug
4+
static: public
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
---
22
addr: 0.0.0.0:6789
3-
mode: debug
3+
mode: release
44
static: public

docker/Dockerfile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
1-
FROM alpine:latest
2-
1+
FROM golang:1.14-alpine
2+
WORKDIR /app
3+
ADD . /app
4+
RUN go get -u golang.org/x/tools/cmd/goimports && go mod tidy
5+
RUN go build -o ssaplayground.service -mod vendor
6+
EXPOSE 6789
7+
ENTRYPOINT [ "/app/ssaplayground.service", "-conf=/app/configs/docker.yaml"]

public/assets/screen.png

348 KB
Loading

public/buildbox/.gitkeep

Whitespace-only changes.

public/buildbox/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<!-- this is intended for empty -->

0 commit comments

Comments
 (0)