Add Dockerfile
This commit is contained in:
parent
1d12828313
commit
d048795140
12
Dockerfile
12
Dockerfile
@ -1,12 +0,0 @@
|
||||
FROM golang:1.14.6-alpine3.12
|
||||
RUN mkdir /dione
|
||||
COPY . /dione
|
||||
WORKDIR /dione
|
||||
|
||||
RUN apk add git
|
||||
RUN apk add --update make
|
||||
RUN go mod download
|
||||
|
||||
RUN make build
|
||||
|
||||
CMD ["./dione"]
|
@ -1,11 +1,3 @@
|
||||
dione:
|
||||
build: .
|
||||
working_dir: /go/src
|
||||
ports:
|
||||
- "5000:5000"
|
||||
links:
|
||||
- redisDB
|
||||
redisDB:
|
||||
image: redis
|
||||
ports:
|
||||
- "6379:6379"
|
||||
dockerfile: ./docker/Dockerfile
|
18
docker/Dockerfile
Normal file
18
docker/Dockerfile
Normal file
@ -0,0 +1,18 @@
|
||||
FROM golang:1.16.6-alpine3.14 as builder
|
||||
|
||||
RUN mkdir /app
|
||||
COPY . /app
|
||||
WORKDIR /app
|
||||
|
||||
RUN apk add build-base
|
||||
RUN apk add linux-headers
|
||||
RUN go mod download
|
||||
|
||||
RUN go build -v ./cmd/dione/dione.go
|
||||
|
||||
FROM alpine:latest
|
||||
WORKDIR /app
|
||||
COPY --from=builder /app/dione .
|
||||
COPY docker/entrypoint.sh .
|
||||
RUN chmod +x /app/entrypoint.sh
|
||||
CMD ["/app/entrypoint.sh"]
|
8
docker/entrypoint.sh
Normal file
8
docker/entrypoint.sh
Normal file
@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ -z "$CONFIG_PATH" ]; then
|
||||
echo "Config path is required!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
/app/dione -config "$CONFIG_PATH"
|
Loading…
Reference in New Issue
Block a user