forked from dimaskiddo/go-whatsapp-rest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
34 lines (23 loc) · 1004 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# Builder Image
# ---------------------------------------------------
FROM dimaskiddo/alpine:go-1.12 AS go-builder
WORKDIR /usr/src/app
COPY . ./
RUN go mod download \
&& CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -a -o main cmd/main/main.go
# Final Image
# ---------------------------------------------------
FROM dimaskiddo/alpine:base
MAINTAINER Dimas Restu Hidayanto <[email protected]>
ARG SERVICE_NAME="go-whatsapp-rest"
ENV PATH="$PATH:/usr/app/${SERVICE_NAME}" \
CONFIG_ENV="production" \
PRODUCTION_ROUTER_BASE_PATH="/api/v1/whatsapp"
WORKDIR /usr/app/${SERVICE_NAME}
COPY --from=go-builder /usr/src/app/config/ ./config
COPY --from=go-builder /usr/src/app/main ./go-whatsapp-rest
RUN chmod 777 config/stores config/uploads
EXPOSE 3000
HEALTHCHECK --interval=5s --timeout=3s CMD ["sh", "-c", "curl http://127.0.0.1:3000${PRODUCTION_ROUTER_BASE_PATH}/health || exit 1"]
VOLUME ["/usr/app/config/stores","/usr/app/config/uploads"]
CMD ["go-whatsapp-rest"]