-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
41 lines (28 loc) · 1.1 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
FROM node:14.2 AS builder
ARG OWNER="fabrizio <[email protected]>"
ARG BOT_NAME="myhubot"
ARG DESCRIPTION="I help people without hating them"
RUN useradd -ms /bin/bash hubot \
&& chown hubot /usr/local/lib/node_modules \
&& chown -R hubot /usr/local/bin \
&& apt-get update && apt-get install -y jq
USER hubot
WORKDIR /home/hubot
RUN npm install -g yo generator-hubot@latest \
&& yo hubot --owner="${OWNER}" \
--name="${BOT_NAME}" \
--description="${DESCRIPTION}" \
--adapter="slack" \
--defaults
ARG HUBOT_VERSION="3.3.2"
RUN jq --arg HUBOT_VERSION "$HUBOT_VERSION" '.dependencies.hubot = $HUBOT_VERSION' package.json > /tmp/package.json\
&& mv /tmp/package.json .
FROM node:14.2-alpine AS prod
RUN addgroup -S hubot && adduser -S hubot -G hubot \
&& apk update && apk add --no-cache jq
USER hubot
WORKDIR /home/hubot
COPY --from=builder --chown=hubot /home/hubot/ /home/hubot/
COPY --chown=hubot ./scripts /home/hubot/scripts
COPY --chown=hubot ./entrypoint.sh /home/hubot/entrypoint.sh
ENTRYPOINT ["/home/hubot/entrypoint.sh"]