-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathContainerfile
63 lines (50 loc) · 1.3 KB
/
Containerfile
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
62
63
# FROM python:3.9.6-slim-buster
FROM python:3.8.3-slim-buster AS builder
# Set python environment variables
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=0 \
PIP_DISABLE_PIP_VERSION_CHECK=1
RUN addgroup \
--gid 1234 app_group \
&& adduser \
--uid 5678 \
--gid 1234 \
--home /home/app_user \
--shell /bin/bash \
--disabled-login \
--disabled-password \
--gecos "User for app" \
app_user \
&& chmod 0700 /home/app_user
RUN apt-get update \
&& apt-get install -y --no-install-suggests --no-install-recommends \
curl \
ca-certificates \
git \
nano \
locales \
&& apt-get -y autoremove \
&& apt-get -y clean \
&& rm -rf /var/lib/apt/lists/*
RUN sed --in-place '/^#.* pt_BR.UTF-8 /s/^#//' /etc/locale.gen \
&& locale-gen
RUN pip install 'poetry==1.2.0a1' \
&& poetry config virtualenvs.create true
ENV PATH="/root/.poetry/bin:$PATH"
COPY . /app/
FROM python:3.8.3-slim-buster
COPY --from=builder /app/dist/*.whl /app/
RUN pip install --no-cache-dir /app/*.whl
RUN addgroup \
--gid 1234 app_group \
&& adduser \
--uid 5678 \
--gid 1234 \
--home /home/app_user \
--shell /bin/bash \
--disabled-login \
--disabled-password \
--gecos "User for app" \
app_user \
&& chmod 0700 /home/app_user