forked from luebke-dev/signal-cli-rest-api
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
52 lines (41 loc) · 1.5 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
FROM python:3.9-slim
# Create signal-cli user
ENV HOME /srv/signal
RUN addgroup --system --gid 1000 sgn && adduser --system --home $HOME --gid 1000 --uid 999 sgn
# Install java
RUN set -eux; \
mkdir -p /usr/share/man/man1; \
apt-get update; \
apt-get install --no-install-recommends -y \
ca-certificates \
curl \
locales \
; \
curl -sL -o /etc/apt/trusted.gpg.d/morph027-signal-cli.asc https://packaging.gitlab.io/signal-cli/gpg.key; \
echo "deb https://packaging.gitlab.io/signal-cli signalcli main" | tee /etc/apt/sources.list.d/morph027-signal-cli.list; \
apt-get update; \
apt-get install --no-install-recommends -y \
signal-cli-native \
; \
rm -rf /var/lib/apt/lists/*
RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && \
locale-gen
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
WORKDIR $HOME
# Copy poetry.lock* in case it doesn't exist in the repo
COPY --chown=sgn:sgn ./pyproject.toml ./poetry.lock* ./
# Install Poetry & disable virtualenv creation
RUN pip install --no-cache poetry && \
poetry config virtualenvs.create false
RUN poetry install --no-root --only main && \
rm -rf ~/.cache/{pip,pypoetry}
# Copy app
COPY --chown=sgn:sgn ./signal_cli_rest_api/ signal_cli_rest_api/
# Prepare mount point for signal-cli
RUN mkdir -p $HOME/.local/share/signal-cli
RUN chown -R sgn:sgn $HOME/.local/share/signal-cli
EXPOSE 8000
USER sgn
CMD ["uvicorn", "signal_cli_rest_api.main:app", "--host", "0.0.0.0"]