-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile-Alpine
66 lines (49 loc) · 1.57 KB
/
Dockerfile-Alpine
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
64
65
66
FROM alpine:latest
# App Path
ARG APP_PATH="/opt/app"
# Define venv Path
ARG VENV_PATH="/opt/venv"
# Create Directory for App
RUN mkdir -p "${APP_PATH}"
# Copy Sources
COPY app/ "${APP_PATH}"
# Copy other Files
COPY README.md "${APP_PATH}"
# Change Directory
WORKDIR "${APP_PATH}"
# Update Sources
# Install required Packages
RUN --mount=type=cache,mode=0777,target=/var/cache/apk,sharing=locked \
--mount=type=cache,mode=0777,target=/var/lib/apk,sharing=locked \
apk update && \
apk add python3 py3-pip git shadow && \
apk add bash iproute2
# Not Currently Enabled Packages
#RUN --mount=type=cache,mode=0777,target=/var/cache/apk,sharing=locked \
# --mount=type=cache,mode=0777,target=/var/lib/apk,sharing=locked \
# apk update && \
# apk add rrdtool
# Change Shell
RUN chsh -s /bin/bash root
RUN export SHELL="/bin/bash"
RUN ln -sf /bin/bash /bin/sh
# set ENV to execute startup scripts
ENV ENV /etc/profile
# Create venv
RUN python3 -m venv "${VENV_PATH}"
# Set PATH Variable to include venv
ENV PATH="${VENV_PATH}/bin:$PATH"
# Activate venv
RUN source "${VENV_PATH}/bin/activate"
#RUN sh -c ". ${VENV_PATH}/bin/activate"
# Install required Packages
RUN --mount=type=cache,mode=0777,target=/var/lib/pip,sharing=locked \
pip install --cache-dir /var/lib/pip -r "${APP_PATH}/requirements.txt"
# Export Web Port
EXPOSE 5000
# Run the Main App
#CMD ["python", "-u", "app.py"]
# Copy and Execute Script for Installation and Initialization of App
COPY docker-entrypoint.sh /opt/
RUN chmod +x /opt/docker-entrypoint.sh
ENTRYPOINT ["/opt/docker-entrypoint.sh"]