Skip to content

Commit

Permalink
Add Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
mattrobenolt committed Oct 18, 2023
1 parent 41b14d6 commit c2b08ee
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .dockerignore
@@ -0,0 +1,6 @@
.git
.gitignore
.dockerignore
Dockerfile
Makefile
bin
15 changes: 15 additions & 0 deletions Dockerfile
@@ -0,0 +1,15 @@
FROM golang:1.21-bookworm AS build

WORKDIR /usr/src/ps-http-sim

COPY go.mod go.sum ./
RUN go mod download && go mod verify

COPY . .
RUN CGO_ENABLED=0 GOOS=linux go install -v github.com/mattrobenolt/ps-http-sim

FROM scratch
COPY --from=build /go/bin/ps-http-sim /ps-http-sim

EXPOSE 8080
ENTRYPOINT ["/ps-http-sim", "-http-addr=0.0.0.0"]
10 changes: 8 additions & 2 deletions Makefile
Expand Up @@ -46,8 +46,11 @@ tools: $(PROTO_TOOLS)
$(PSDB_V1ALPHA1)/database.pb.go: $(PROTO_TOOLS) proto-src/planetscale/psdb/v1alpha1/database.proto | $(PSDB_PROTO_OUT)
$(BIN)/buf generate -v proto-src/planetscale/psdb/v1alpha1/database.proto

run: proto
go run $(gomod) \
$(BIN)/ps-http-sim: main.go go.mod go.sum
GOBIN=$(abspath $(BIN)) go install $(gomod)

run: $(BIN)/ps-http-sim proto
$(BIN)/ps-http-sim \
-http-addr=127.0.0.1 \
-http-port=8080 \
-mysql-addr=127.0.0.1 \
Expand All @@ -56,3 +59,6 @@ run: proto
-mysql-no-pass \
-mysql-max-rows=1000 \
-mysql-dbname=mysql

docker:
docker build --rm -t ps-http-sim .

0 comments on commit c2b08ee

Please sign in to comment.