Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a dockerfile for CI to run in #193

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 21 additions & 0 deletions docker/Dockerfile
@@ -0,0 +1,21 @@
FROM debian:buster-slim

RUN set -ex \
&& apt-get update \
&& apt-get install -y \
build-essential \
python2.7-dev \
libffi-dev \
sqlite3 \
python-pip \
libssl-dev \
python-virtualenv \
libxslt1-dev

# Install dependencies
RUN pip install https://github.com/matrix-org/sydent/tarball/master \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One usually builds from the checked out source, rather than just always fetching master.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You probably want to run this last in the run script.

pip and setuptools can also break when you go down this path as I found while trying to build this out myself here

email templates wont translate over from a pip install.

Running as root is also incredibly dangerous as you can break out of the container

&& pip install --upgrade pip \
&& pip install --upgrade setuptools

# Copy in and run the start script
COPY ./sydent-ci.sh /sydent-ci.sh
6 changes: 6 additions & 0 deletions docker/README.md
@@ -0,0 +1,6 @@
# Docker

Currently only a single, official docker container
(`matrixdotorg/sydent-build`) is provided. It is intended to set up a running
environment for testing Sydent and nothing more. You can find it [on Docker
hub](https://hub.docker.com/r/matrixdotorg/sydent-build).
18 changes: 18 additions & 0 deletions docker/sydent-ci.sh
@@ -0,0 +1,18 @@
#!/usr/bin/env bash

# Install any new dependencies
pip install -e .

# Start Sydent and run for 5s
timeout 5s python -m sydent.sydent

# Check that it started up correctly
if [ $? -eq 124 ]; then
# Timeout got it, so it must've been running correctly
echo "Sydent startup up successfully"
exit 0
else
# Sydent exited before the timeout. Something went wrong
echo "Sydent failed to start"
echo 1
fi