Skip to content

Commit

Permalink
feat : docker mackfile setup
Browse files Browse the repository at this point in the history
  • Loading branch information
seipan committed Oct 5, 2023
1 parent 5d3e0f4 commit 7d6516d
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 0 deletions.
26 changes: 26 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
## Build
FROM golang:1.20-buster AS build

WORKDIR /go/src/github.com/seipan/mylb

COPY go.mod ./
COPY go.sum ./

RUN go mod download

COPY . .

RUN go build -o /docker-gs-ping

## Deploy
FROM gcr.io/distroless/base-debian10

WORKDIR /

COPY --from=build /docker-gs-ping /docker-gs-ping

EXPOSE 8080

USER nonroot:nonroot

ENTRYPOINT ["/docker-gs-ping"]
25 changes: 25 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
DOCKER_COMPOSE_LOCAL_SERVER := docker-compose.yml

.PHONY: ts-re
ts-re:
cd testserver && make re

.PHONY: ts-down
ts-down:
cd testserver && make down

.PHONY: up
up:
docker-compose \
-f $(DOCKER_COMPOSE_LOCAL_SERVER) up -d


.PHONY: down
down:
docker-compose \
-f $(DOCKER_COMPOSE_LOCAL_SERVER) down \
--rmi all --volumes --remove-orphans


.PHONY: re
re:down up
10 changes: 10 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: '3'
services:
serve:
build:
context: .
dockerfile: Dockerfile
ports:
- 8080:8080
volumes:
- ../../:/go/src/github.com/seipan/mylb

0 comments on commit 7d6516d

Please sign in to comment.