forked from bbernhard/signal-cli-rest-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
60 lines (45 loc) · 1.96 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
FROM golang:1.13-buster AS buildcontainer
ARG SIGNAL_CLI_VERSION=0.6.12
ARG SWAG_VERSION=1.6.7
ENV GIN_MODE=release
RUN apt-get update \
&& apt-get install -y --no-install-recommends wget default-jre software-properties-common git locales \
&& rm -rf /var/lib/apt/lists/*
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
dpkg-reconfigure --frontend=noninteractive locales && \
update-locale LANG=en_US.UTF-8
ENV LANG en_US.UTF-8
RUN cd /tmp/ \
&& git clone https://github.com/swaggo/swag.git swag-${SWAG_VERSION} \
&& cd swag-${SWAG_VERSION} \
&& git checkout v${SWAG_VERSION} \
&& make \
&& cp /tmp/swag-${SWAG_VERSION}/swag /usr/bin/swag \
&& rm -r /tmp/swag-${SWAG_VERSION}
RUN cd /tmp/ \
&& git clone https://github.com/AsamK/signal-cli.git signal-cli-${SIGNAL_CLI_VERSION} \
&& cd signal-cli-${SIGNAL_CLI_VERSION} \
&& git checkout v${SIGNAL_CLI_VERSION} \
&& ./gradlew build \
&& ./gradlew installDist \
&& ln -s /tmp/signal-cli-${SIGNAL_CLI_VERSION}/build/install/signal-cli/ /tmp/signal-cli
COPY src/api /tmp/signal-cli-rest-api-src/api
COPY src/main.go /tmp/signal-cli-rest-api-src/
COPY src/go.mod /tmp/signal-cli-rest-api-src/
COPY src/go.sum /tmp/signal-cli-rest-api-src/
RUN cd /tmp/signal-cli-rest-api-src && swag init && go build
# Start a fresh container for release container
FROM adoptopenjdk:11-jdk-hotspot-bionic
RUN apt-get update \
&& apt-get install -y --no-install-recommends setpriv \
&& rm -rf /var/lib/apt/lists/*
COPY --from=buildcontainer /tmp/signal-cli-rest-api-src/signal-cli-rest-api /usr/bin/signal-cli-rest-api
COPY --from=buildcontainer /tmp/signal-cli /opt/signal-cli
COPY entrypoint.sh /entrypoint.sh
RUN groupadd -g 1000 signal-api \
&& useradd --no-log-init -M -d /home -s /bin/bash -u 1000 -g 1000 signal-api \
&& ln -s /opt/signal-cli/bin/signal-cli /usr/bin/signal-cli \
&& mkdir -p /signal-cli-config/ \
&& mkdir -p /home/.local/share/signal-cli
EXPOSE 8080
ENTRYPOINT ["/entrypoint.sh"]