Merge pull request #18 from davidlick/containerize

Add Dockerfile and make directives
This commit was merged in pull request #18.
This commit is contained in:
David Lick
2021-06-21 12:55:56 -04:00
committed by GitHub
2 changed files with 25 additions and 0 deletions
+11
View File
@@ -0,0 +1,11 @@
FROM golang:1.16-alpine
WORKDIR /go/src/github.com/davidlick/supermarket-api/
COPY . .
WORKDIR ./cmd/api/
RUN go build -o supermarket-api -v ./...
EXPOSE 3000
CMD ["./supermarket-api"]
+14
View File
@@ -22,5 +22,19 @@ build:
run: run:
go run cmd/api/*.go go run cmd/api/*.go
docker-build:
docker build -t supermarket-api-image .
docker-run:
docker run \
--rm \
--name supermarket-api \
-p "3000:3000" \
-e "ENV=dev" \
-e "APIPORT=3000" \
-e "LOGLEVEL=debug" \
-e "DMLINITFILE=../../defaultproduce.json" \
supermarket-api-image
clean: clean:
rm ./supermarket-api ./coverage.out rm ./supermarket-api ./coverage.out