Add Dockerfile and make directives #18
+11
@@ -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"]
|
||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user