Skip to content

Commit 7c58540

Browse files
djmitchetasn
authored andcommitted
Create a testing docker image
1 parent 58163d6 commit 7c58540

File tree

6 files changed

+94
-0
lines changed

6 files changed

+94
-0
lines changed

.dockerignore

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/db.sqlite3*
2+
Session.vim
3+
/local_settings.py
4+
.venv
5+
/assets
6+
/logs
7+
/.coverage
8+
/tmp
9+
/media
10+
11+
__pycache__
12+
.*.swp
13+
14+
/.*
15+
16+
/sandbox

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,12 @@ Here are the update steps:
138138
4. Run the migration tool to migrate all of your data.
139139
5. Add your new EteSync 2.0 accounts to all of your devices.
140140

141+
# Testing
142+
143+
Docker images named `etesync/test-server:<version>` and `:latest` are available for testing etesync clients.
144+
This docker image starts a server on port 3735 that supports user signup (without email confirmation), is in debug mode (thus supporting the reset endpoint), and stores its data locally.
145+
It is in no way suitable for production usage, but is able to start up quickly and makes a good component of CI for etesync clients and users of those clients.
146+
141147
# License
142148

143149
Etebase is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License version 3 as published by the Free Software Foundation. See the [LICENSE](./LICENSE) for more information.

docker/build.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#! /bin/bash
2+
3+
# Build the `test-server` image, which runs the server in a simple configuration
4+
# designed to be used in tests, based on the current git revision.
5+
6+
TAG="${1:-latest}"
7+
8+
echo "Building working copy to etesync/test-server:${TAG}"
9+
10+
ETESYNC_VERSION=$(git describe --tags)
11+
12+
docker build \
13+
--build-arg ETESYNC_VERSION=${ETESYNC_VERSION} \
14+
-t etesync/test-server:${TAG} \
15+
-f docker/test-server/Dockerfile \
16+
.

docker/test-server/Dockerfile

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
FROM python:3.9.0-alpine
2+
3+
ARG ETESYNC_VERSION
4+
5+
ENV PIP_DISABLE_PIP_VERSION_CHECK=1
6+
ENV PIP_NO_CACHE_DIR=1
7+
8+
# install packages and pip requirements first, in a single step,
9+
COPY /requirements.txt /requirements.txt
10+
RUN set -ex ;\
11+
apk add libpq postgresql-dev --virtual .build-deps coreutils gcc libc-dev libffi-dev make ;\
12+
pip install -U pip ;\
13+
pip install --no-cache-dir --progress-bar off -r /requirements.txt ;\
14+
apk del .build-deps make gcc coreutils ;\
15+
rm -rf /root/.cache
16+
17+
COPY . /app
18+
19+
RUN set -ex ;\
20+
mkdir -p /data/static /data/media ;\
21+
cd /app ;\
22+
mkdir -p /etc/etebase-server ;\
23+
cp docker/test-server/etebase-server.ini /etc/etebase-server ;\
24+
sed -e '/ETEBASE_CREATE_USER_FUNC/ s/^#*/#/' -i /app/etebase_server/settings.py ;\
25+
chmod +x docker/test-server/entrypoint.sh
26+
27+
# this is a test image and should start up quickly, so it starts with the DB
28+
# and static data already fully set up.
29+
RUN set -ex ;\
30+
cd /app ;\
31+
python manage.py migrate ;\
32+
python manage.py collectstatic --noinput
33+
34+
ENV ETESYNC_VERSION=${ETESYNC_VERSION}
35+
VOLUME /data
36+
EXPOSE 3735
37+
38+
ENTRYPOINT ["/app/docker/test-server/entrypoint.sh"]

docker/test-server/entrypoint.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#! /bin/sh
2+
3+
echo "Running etesync test server ${ETESYNC_VERSION}"
4+
5+
cd /app
6+
uvicorn etebase_server.asgi:application --host 0.0.0.0 --port 3735

docker/test-server/etebase-server.ini

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[global]
2+
secret_file = secret.txt
3+
debug = true
4+
static_root = /data/static
5+
media_root = /data/media
6+
7+
[allowed_hosts]
8+
allowed_host1 = *
9+
10+
[database]
11+
engine = django.db.backends.sqlite3
12+
name = /db.sqlite3

0 commit comments

Comments
 (0)