mirror of
https://github.com/frappe/frappe_docker.git
synced 2026-06-23 00:05:09 +00:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
9524a87c11
5 changed files with 47 additions and 41 deletions
|
|
@ -26,10 +26,5 @@ install:
|
|||
- ./dbench setup hosts
|
||||
|
||||
script:
|
||||
- docker-compose ps | grep -i frappe
|
||||
- docker-compose ps | grep -i redis-cache
|
||||
- docker-compose ps | grep -i redis-queue
|
||||
- docker-compose ps | grep -i redis-socketio
|
||||
- docker-compose ps | grep -i mariadb
|
||||
- ./test.sh
|
||||
- ./dbench setup docker stop
|
||||
|
|
|
|||
36
Dockerfile
36
Dockerfile
|
|
@ -3,38 +3,42 @@
|
|||
FROM debian:9.6-slim
|
||||
LABEL author=frappé
|
||||
|
||||
# Set locale C.UTF-8 for mariadb and general locale data
|
||||
ENV LANG C.UTF-8
|
||||
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends locales \
|
||||
&& sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen \
|
||||
&& dpkg-reconfigure --frontend=noninteractive locales \
|
||||
&& apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Set locale en_us.UTF-8 for mariadb and general locale data
|
||||
ENV PYTHONIOENCODING=utf-8
|
||||
ENV LANGUAGE=en_US.UTF-8
|
||||
ENV LANG=en_US.UTF-8
|
||||
ENV LC_ALL=en_US.UTF-8
|
||||
|
||||
# Install all neccesary packages
|
||||
RUN apt-get update && apt-get install -y --no-install-suggests --no-install-recommends build-essential cron curl git iputils-ping libffi-dev \
|
||||
liblcms2-dev libldap2-dev libmariadbclient-dev libsasl2-dev libssl-dev libtiff5-dev libwebp-dev mariadb-client \
|
||||
python-dev python-pip python-setuptools python-tk redis-tools rlwrap software-properties-common sudo tk8.6-dev \
|
||||
vim xfonts-75dpi xfonts-base wget \
|
||||
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-suggests --no-install-recommends \
|
||||
build-essential cron curl git libffi-dev liblcms2-dev libldap2-dev libmariadbclient-dev libsasl2-dev libssl-dev libtiff5-dev \
|
||||
libwebp-dev mariadb-client iputils-ping python-dev python-pip python-setuptools python-tk redis-tools rlwrap \
|
||||
software-properties-common sudo tk8.6-dev vim xfonts-75dpi xfonts-base wget wkhtmltopdf \
|
||||
&& apt-get clean && rm -rf /var/lib/apt/lists/* \
|
||||
&& pip install --upgrade setuptools pip --no-cache \
|
||||
&& curl https://deb.nodesource.com/node_10.x/pool/main/n/nodejs/nodejs_10.10.0-1nodesource1_amd64.deb > node.deb \
|
||||
&& dpkg -i node.deb \
|
||||
&& rm node.deb \
|
||||
&& npm install -g yarn
|
||||
|
||||
# Install wkhtmltox correctly
|
||||
RUN wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz \
|
||||
&& tar xvf wkhtmltox-0.12.4_linux-generic-amd64.tar.xz \
|
||||
&& mv wkhtmltox/bin/wkhtmlto* /usr/bin/ \
|
||||
&& ln -nfs /usr/bin/wkhtmltopdf /usr/local/bin/wkhtmltopdf
|
||||
|
||||
# Add frappe user and setup sudo
|
||||
RUN useradd -ms /bin/bash -G sudo frappe \
|
||||
&& printf '# Sudo rules for frappe\nfrappe ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers.d/frappe
|
||||
RUN groupadd -g 500 frappe \
|
||||
&& useradd -ms /bin/bash -u 500 -g 500 -G sudo frappe \
|
||||
&& printf '# Sudo rules for frappe\nfrappe ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/frappe \
|
||||
&& chown -R 500:500 /home/frappe
|
||||
|
||||
WORKDIR /home/frappe
|
||||
# Install bench
|
||||
RUN pip install -e git+https://github.com/frappe/bench.git#egg=bench --no-cache
|
||||
|
||||
USER frappe
|
||||
|
||||
# Add some bench files
|
||||
COPY --chown=frappe:frappe ./frappe-bench /home/frappe/frappe-bench
|
||||
|
||||
WORKDIR /home/frappe/frappe-bench
|
||||
|
||||
EXPOSE 8000 9000 6787
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# Frappe on Docker
|
||||
|
||||
[](https://travis-ci.org/frappe/frappe_docker)
|
||||
[](https://travis-ci.com/frappe/frappe_docker)
|
||||
|
||||
This is a repo designed to aide setting up frappe/ERPNext on docker.
|
||||
|
||||
|
|
@ -38,7 +38,7 @@ Unfortunately, this container is not curently suited for a production environmen
|
|||
./dbench start
|
||||
```
|
||||
|
||||
4. Use Frappe:
|
||||
4. Use Frappe:
|
||||
Open your browser to `localhost:8000/login`. Then login using the username `Administrator` and the password `admin`.
|
||||
|
||||
### Basic Usage of `./dbench`
|
||||
|
|
@ -51,7 +51,7 @@ Unfortunately, this container is not curently suited for a production environmen
|
|||
- `stop`: Stops the containers with `docker-compose stop`.
|
||||
- `down`: Deletes the containers and the coresponding volumes with `docker-compose down`.
|
||||
|
||||
- `./dbench setup hosts`: Adds all sites to the containers hosts file.
|
||||
- `./dbench setup hosts`: Adds all sites to the containers hosts file.
|
||||
**Note:** Run this after you've added a new site to avoid errors.
|
||||
|
||||
- `./dbench -c frappe | root <command to run>`: Runs a command in the container, as the selected user.
|
||||
|
|
|
|||
29
dbench
29
dbench
|
|
@ -24,11 +24,14 @@ elif [[ "$1" == 'setup' ]]; then
|
|||
docker-compose up -d
|
||||
fi
|
||||
elif [[ "$2" == 'hosts' ]]; then
|
||||
a=$(run frappe "ls sites/*/site_config.json | grep -o '/.\+/'") \
|
||||
a=$(run frappe "ls sites/*/site_config.json | grep -o '/.\+/'")
|
||||
a="${a//$'\n'/ }"
|
||||
a=$(echo "$a" | tr -d / )
|
||||
result="127.0.0.1 ${a}"
|
||||
run root "echo ${result} | tee --append /etc/hosts"
|
||||
run root "echo ${result} | tee -a /etc/hosts"
|
||||
else
|
||||
IFS=" "
|
||||
run frappe "bench $*"
|
||||
fi
|
||||
elif [[ "$1" == '-c' ]]; then
|
||||
shift
|
||||
|
|
@ -36,22 +39,22 @@ elif [[ "$1" == '-c' ]]; then
|
|||
shift
|
||||
run "$user" "$@"
|
||||
elif [[ "$1" == '-h' ]]; then
|
||||
echo "$0 [-h] | [ -c frappe | root <command to run> ] [ <command to send to bench> ]"
|
||||
echo "$0 [-h] | [-c frappe|root command] | [setup hosts|docker [stop|down]] | [bench_command]"
|
||||
echo ""
|
||||
echo "$0 extends the Frappe Bench tool, and is used like it. However, it extends the tool in a few places."
|
||||
echo "$0 is a wrapper for the Frappe Bench tool, and is used like it. However, it extends the tool in a few places."
|
||||
echo "Usage:"
|
||||
echo " $0"
|
||||
echo " Launches you into an interactive shell in the container as user frappe"
|
||||
echo " $0 setup docker [ stop | down ]"
|
||||
echo " Starts and builds the docker containers using \"docker-compose up -d\""
|
||||
echo " $0 setup hosts"
|
||||
echo " Adds all sites to the containers hosts file"
|
||||
echo " $0 -c frappe | root <command to run>"
|
||||
echo " Runs a command in the container, as the selected user"
|
||||
echo " $0 -h"
|
||||
echo " Shows this help message"
|
||||
echo " $0"
|
||||
echo " Launches you into an interactive shell in the container as user frappe"
|
||||
echo " $0 <command to send to bench>"
|
||||
echo " Runs a command in bench, i.e. $0 new-site site1.local = bench new-site site1.local"
|
||||
echo " Runs the bench command <command>, i.e. $0 new-site \"site1.local\" = bench new-site \"site1.local\""
|
||||
echo " $0 setup docker [ stop | down ]"
|
||||
echo " Builds and starts the docker containers using \"docker-compose up -d\""
|
||||
echo " $0 setup hosts"
|
||||
echo " Adds all site names to the containers hosts file"
|
||||
echo " $0 -c frappe | root <command to run>"
|
||||
echo " Runs a command in the container, as the selected user"
|
||||
else
|
||||
IFS=" "
|
||||
run frappe "bench $*"
|
||||
|
|
|
|||
12
test.sh
12
test.sh
|
|
@ -1,8 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
cat <(./dbench start) &
|
||||
docker container ls | grep frappe
|
||||
docker container ls | grep mariadb
|
||||
docker container ls | grep redis-cache
|
||||
docker container ls | grep redis-queue
|
||||
docker container ls | grep redis-socketio
|
||||
|
||||
sleep 5
|
||||
cat <(./dbench start) &
|
||||
|
||||
while ! [[ $i == 20 ]]
|
||||
do
|
||||
|
|
@ -11,7 +15,7 @@ do
|
|||
} 1>&2
|
||||
sleep 2
|
||||
i=$((i + 1))
|
||||
echo "${output}" | grep '<title> Login </title>' && exit
|
||||
done
|
||||
|
||||
|
||||
echo "${output}" | grep '<title> Login </title>' || exit 1
|
||||
if ! [[ "$?" == 0 ]]; then exit 1; fi
|
||||
|
|
|
|||
Loading…
Reference in a new issue