-
Notifications
You must be signed in to change notification settings - Fork 0
/
base.Dockerfile
63 lines (50 loc) · 1.87 KB
/
base.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
61
ARG UNAME=pi
ARG UID=1000
ARG GID=1000
ARG APP_VERSION="v0.0.0"
# Stage: base-dev
FROM python:latest AS base-dev
ARG UNAME
ARG UID
ARG GID
ARG APP_VERSION
RUN apt-get update -y \
# && apt-get upgrade -y \
&& apt-get install -y \
# python3 \
# python3-pip \
# python-is-python3 \
git \
npm \
sqlite3 wireguard wireguard-tools \
net-tools iproute2 iptables libcap2-bin libcap2 \
iptraf-ng procps tcpdump \
sudo conntrack tzdata \
&& apt-get clean
RUN npm install -g @angular/cli
RUN pip install --break-system-packages --upgrade qrcode[pil] colorlog Django djangorestframework django-cors-headers django-spa drf-standardized-errors django-dirtyfields requests cryptography
ENV APP_VERSION=${APP_VERSION}
ENV IMAGE_STAGE=base-dev
RUN groupadd -g $GID -o $UNAME && useradd -m -u $UID -g $GID -o -s /bin/bash $UNAME && echo "$UNAME:$UNAME" | chpasswd
RUN usermod -aG sudo $UNAME && echo "$UNAME ALL=(ALL) NOPASSWD:ALL">>/etc/sudoers
# Stage: base-live
FROM python:alpine AS base-live
ARG UNAME
ARG UID
ARG GID
ARG APP_VERSION
RUN apk update \
&& apk upgrade
RUN apk add --no-cache --update wireguard-tools iptables openresolv net-tools \
iptraf-ng procps tcpdump sudo conntrack-tools \
tzdata gcc libressl-dev musl-dev libffi-dev \
bind-tools \
&& pip install --no-cache-dir --break-system-packages --upgrade qrcode[pil] colorlog \
Django djangorestframework django-cors-headers django-spa drf-standardized-errors django-dirtyfields \
cryptography requests \
&& apk del gcc libressl-dev musl-dev libffi-dev
ENV APP_VERSION=${APP_VERSION}
ENV IMAGE_STAGE=base-live
RUN addgroup --gid "$GID" "$UNAME"
RUN adduser $UNAME --disabled-password --gecos "" --ingroup "$UNAME" --no-create-home --uid "$UID"
RUN echo '%pi ALL=(ALL) NOPASSWD:ALL'>>/etc/sudoers