-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
executable file
·82 lines (65 loc) · 2.16 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
FROM centos
ENV PROJECT_NAME my_project_name
ENV PROJECT_PATH /var/www/$PROJECT_NAME
##############################
# Install dependency
##############################
RUN yum install -y gcc make zlib-devel openssl-devel \
xz-devel groupinstall development \
yum-utils wget
##############################
# Install Python
##############################
RUN wget --progress=dot:mega https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tar.xz
RUN tar -xvvf Python-3.6.1.tar.xz > /dev/null
RUN cd Python-3.6.1 && ./configure && make && make install
##############################
# Install gosu
##############################
ENV GOSU_VERSION 1.10
RUN set -ex; \
\
yum -y install epel-release; \
yum -y install wget dpkg; \
\
dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')"; \
wget -O /usr/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch"; \
wget -O /tmp/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc"; \
\
# verify the signature
export GNUPGHOME="$(mktemp -d)"; \
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \
gpg --batch --verify /tmp/gosu.asc /usr/bin/gosu; \
rm -r "$GNUPGHOME" /tmp/gosu.asc; \
\
chmod +x /usr/bin/gosu; \
# verify that the binary works
gosu nobody true; \
\
yum -y remove wget dpkg; \
yum clean all
######################################
# Setting Project
######################################
RUN mkdir -p $PROJECT_PATH
# Cd to working directory
WORKDIR $PROJECT_PATH
# Copy requirements for catch
ADD ./requirements.txt $PROJECT_PATH
# Create virtualenv
RUN pip3 install virtualenv
# Create new user for run app
RUN useradd -u 1000 app
# Install dependency
RUN virtualenv .venv
RUN source .venv/bin/activate && pip3 install -r requirements.txt
# Copy project files
COPY --chown=app . $PROJECT_PATH
VOLUME $PROJECT_PATH/media
VOLUME $PROJECT_PATH/static
# Permission project directory
RUN chmod -R 775 $PROJECT_PATH
# Copy entrypoint script to root directory
COPY ./docker-entrypoint.sh /
RUN chmod +x /docker-entrypoint.sh
ENTRYPOINT ["/docker-entrypoint.sh"]