-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
43 lines (33 loc) · 1.39 KB
/
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
35
36
37
38
39
40
41
42
43
# build stage
ARG CONTAINER_ARCH="amd64"
ARG CONTAINER_OS="linux"
ARG APP_NAME="mq-to-db"
ARG HEALTH_CHECK_PATH="health"
ARG METRICS_PORT="8080"
ARG GO_VERSION="1.18"
FROM golang:${GO_VERSION} AS build-container
RUN apt install -y git gcc make
ADD . /src
RUN cd /src && GOOS=${CONTAINER_OS} GOARCH=${CONTAINER_ARCH} make
# App container
FROM ${CONTAINER_ARCH}/busybox:glibc
LABEL maintainer="Christian González Di Antonio <[email protected]>" \
org.opencontainers.image.authors="Christian González Di Antonio <[email protected]>" \
org.opencontainers.image.url="https://github.com/christiangda/${APP_NAME}" \
org.opencontainers.image.documentation="https://github.com/christiangda/${APP_NAME}" \
org.opencontainers.image.source="https://github.com/christiangda/${APP_NAME}"
EXPOSE ${METRICS_PORT}
RUN mkdir -p /home/nobody && \
mkdir -p /etc/mq-to-db && \
chown -R nobody.nobody /home/nobody && \
chown -R nobody.nobody /etc/mq-to-db
ENV HOME="/home/nobody"
COPY --from=build-container /src/build/mq-to-db /bin/mq-to-db
COPY --from=build-container /src/config-sample.yaml /etc/mq-to-db/config-config.yaml
RUN chmod +x /bin/mq-to-db
#HEALTHCHECK CMD wget --spider -S "http://127.0.0.1:${METRICS_PORT}/${HEALTH_CHECK_PATH}" -T 60 2>&1 || exit 1
VOLUME [ "/home/nobody", "/etc/mq-to-db"]
USER nobody
WORKDIR ${HOME}
ENTRYPOINT [ "/bin/mq-to-db" ]
#CMD [ "/bin/mq-to-db" ]