Add Dockerfile

This commit is contained in:
ChronosX88 2021-08-05 23:12:31 +03:00
parent 1d12828313
commit d048795140
Signed by: ChronosXYZ
GPG Key ID: 085A69A82C8C511A
4 changed files with 27 additions and 21 deletions

View File

@ -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"]

View File

@ -1,11 +1,3 @@
dione: dione:
build: . build: .
working_dir: /go/src dockerfile: ./docker/Dockerfile
ports:
- "5000:5000"
links:
- redisDB
redisDB:
image: redis
ports:
- "6379:6379"

18
docker/Dockerfile Normal file
View 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
View 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"