Skip to content
This repository was archived by the owner on Jun 20, 2021. It is now read-only.

Commit 6d38983

Browse files
author
regisf
committed
Debug Dockerfile
1 parent 631d4ae commit 6d38983

File tree

5 files changed

+50
-32
lines changed

5 files changed

+50
-32
lines changed

bin/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
. ./bin/tests.sh
44

55
cd build
6-
docker build -t pythonregex .
6+
docker build -t pythonregex:101 .

bin/install.sh

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1-
#!/usr/bin/env bash
1+
#!/bin/sh
22

3+
USE_DOCKER=0
34
# Install Python Virtual env only on non docker machine
45
if [ "$1" != "--docker" ];
56
then
67
# Install virtual env
78
printf "Installing python 3 virtual environment\n"
89
python3 -m venv env > /dev/null 2>&1
910
source env/bin/activate
11+
else
12+
USE_DOCKER=1
1013
fi
1114

1215
printf "Update pip\n"
@@ -36,27 +39,35 @@ else
3639
SECRET=`mongo pythonregex --quiet --eval "db.configuration.find({key: 'secret_key'})[0].value"`
3740
fi
3841

42+
# Use env instead of user entry
43+
3944
# Register admin user
40-
printf "\nEnter the admin user name: "
41-
ADMIN_USER=
42-
while [[ ${ADMIN_USER} = "" ]];
43-
do
44-
read ADMIN_USER
45-
done
45+
if [ "${USE_DOCKER}" = "0" ];
46+
then
47+
printf "\nEnter the admin user name: "
48+
ADMIN_USER=
49+
while [[ ${ADMIN_USER} = "" ]];
50+
do
51+
read ADMIN_USER
52+
done
4653

47-
ADMIN_EMAIL=
48-
printf "Enter your email address (for normal connection): "
49-
while [[ ${ADMIN_EMAIL} = "" ]];
50-
do
51-
read ADMIN_EMAIL
52-
done
54+
ADMIN_EMAIL=
55+
printf "Enter your email address (for normal connection): "
56+
while [[ ${ADMIN_EMAIL} = "" ]];
57+
do
58+
read ADMIN_EMAIL
59+
done
60+
61+
printf "Enter the admin password: "
62+
ADMIN_PASSWORD=
63+
while [[ ${ADMIN_PASSWORD} = "" ]];
64+
do
65+
read ADMIN_PASSWORD
66+
done
67+
else
68+
echo "Use docker"
69+
fi
5370

54-
printf "Enter the admin password: "
55-
ADMIN_PASSWORD=
56-
while [[ ${ADMIN_PASSWORD} = "" ]];
57-
do
58-
read ADMIN_PASSWORD
59-
done
6071
PASSWORD=`python -c "import hashlib;print(hashlib.sha256('${SECRET}'.encode() + '${ADMIN_PASSWORD}'.encode()).hexdigest())"`
6172

6273
NOW=`date +%s`

bin/tests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ source env/bin/activate
1313
python tests/test.py
1414

1515
# Quit with the same error code
16-
if [ $? ! 0 ];
16+
if [ $? != 0 ];
1717
then
1818
exit $?
1919
fi

build/Dockerfile

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,24 @@
1-
FROM alpine
1+
FROM ubuntu
22

3-
MAINTAINER Regis FLORET
3+
MAINTAINER Regis FLORET <regisfloret@gmail.com>
44

55
LABEL com.python-regex.version="1.0.1"
66

7-
RUN apk add --no-cache python3 && \
8-
python3 -m ensurepip && \
9-
apk add --no-cache git&& \
10-
rm -r /usr/lib/python*/ensurepip && \
7+
RUN apt-get update && \
8+
apt-get upgrade -y && \
9+
apt-get install apt-utils python3 python3-pip git mongodb -y && \
10+
\
1111
pip3 install --upgrade pip setuptools && \
1212
rm -r /root/.cache && \
13-
git clone https://github.com/regisf/pythonregex.git && \
13+
\
14+
service mongodb start && \
15+
\
16+
git clone -b add-docker https://github.com/regisf/pythonregex.git && \
1417
cd pythonregex && \
15-
bin/install.sh --docker
18+
bin/install.sh --docker && \
19+
\
20+
apt-get autoremove -y && \
21+
apt-get clean
1622

1723
EXPOSE 8888
1824
WORKDIR pythonregex

tests/test.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@
55
python tests/test.py
66
"""
77

8-
__author__ = 'Régis FLORET'
9-
108
import unittest
119

1210

13-
class TestEmailModel(unittest):
11+
__author__ = 'Régis FLORET'
12+
13+
14+
class TestEmailModel(unittest.TestCase):
1415
def test_get_template(self):
1516
self.assertTrue(True)
1617

0 commit comments

Comments
 (0)