Skip to content
This repository was archived by the owner on Aug 26, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG ETEBASE_TAG=master
ARG ETESYNC_WEB_TAG=master
ARG ETEBASE_TAG=057b908565072bf9b1003410c0080f42294d446a
ARG ETESYNC_WEB_TAG=c0d884afd7499d3174b405bb10a2629eec376ecc

ARG PUID=1000
ARG PGID=1000
Expand Down Expand Up @@ -39,7 +39,7 @@ ENV ETEBASE_PORT ${PORT}
# Unfortunately this needs a compiler, so we install one for just this step. We also install
# libpcre3 to enable internal routing in uWSGI.
RUN apt-get update \
&& apt-get install -y build-essential python3-dev libpcre3-dev \
&& apt-get install -y mime-support build-essential python3-dev libpcre3-dev \
&& pip3 install uwsgi \
&& pip3 cache purge \
&& apt-get purge -y --auto-remove build-essential python3-dev libpcre3-dev \
Expand Down
72 changes: 72 additions & 0 deletions Dockerfile.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
ARG `ETEBASE_TAG'=ETEBASE_TAG
ARG `ETESYNC_WEB_TAG'=ETESYNC_WEB_TAG

ARG PUID=1000
ARG PGID=1000
ARG PORT=8080

# =============================================================================
# Build the EteSync web client.

FROM node:12 as web

ARG `ETESYNC_WEB_TAG'

ADD https://github.com/etesync/etesync-web/archive/${`ETESYNC_WEB_TAG'}.tar.gz etesync_web.tar.gz
ENV REACT_APP_DEFAULT_API_PATH "/"
RUN mkdir -p etesync-web \
&& tar xf etesync_web.tar.gz --strip-components=1 -C etesync-web \
&& cd etesync-web \
&& yarn \
&& yarn build

# =============================================================================

FROM python:3.8-slim

ARG `ETEBASE_TAG'
ARG PUID
ARG PGID
ARG PORT

ENV ETEBASE_DIRECTORY "/opt/etebase"
ENV ETEBASE_DATA_DIRECTORY "/data"
ENV ETEBASE_MEDIA_DIRECTORY "/data/media"
ENV ETEBASE_DATABASE_FILE "db.sqlite3"
ENV ETEBASE_PORT ${PORT}

# Install uWSGI.
# Unfortunately this needs a compiler, so we install one for just this step. We also install
# libpcre3 to enable internal routing in uWSGI.
RUN apt-get update \
&& apt-get install -y mime-support build-essential python3-dev libpcre3-dev \
&& pip3 install uwsgi \
&& pip3 cache purge \
&& apt-get purge -y --auto-remove build-essential python3-dev libpcre3-dev \
&& rm -rf /var/lib/apt/lists/*

# Download Etebase.
ADD https://github.com/etesync/server/archive/${`ETEBASE_TAG'}.tar.gz etebase.tar.gz
RUN mkdir -p ${ETEBASE_DIRECTORY} \
&& tar xf etebase.tar.gz --strip-components=1 --exclude="example-configs" -C ${ETEBASE_DIRECTORY} \
&& rm etebase.tar.gz \
&& pip3 install --no-cache-dir -r ${ETEBASE_DIRECTORY}/requirements.txt \
&& ${ETEBASE_DIRECTORY}/manage.py collectstatic

# Copy the web client from the other build stage.
COPY --from=web /etesync-web/build ${ETEBASE_DIRECTORY}/web

# Create a user as which the server will run.
RUN groupadd --gid ${PGID} etebase \
&& useradd --uid ${PUID} --gid etebase --shell /bin/bash etebase

# Copy configuration files and startup script.
COPY config/etebase_server_settings.py ${ETEBASE_DIRECTORY}/etebase_server_settings.py
COPY config/uwsgi.ini /etc/uwsgi/
COPY scripts/init.sh /

VOLUME ${ETEBASE_DATA_DIRECTORY}
EXPOSE ${ETEBASE_PORT}
USER ${PUID}:${PGID}

CMD ["/init.sh"]
21 changes: 21 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
include Makefile.m4

ETEBASE_TAG="$(shell git ls-remote https://github.com/etesync/server.git refs/heads/master|cut -f1)"
ETESYNC_WEB_TAG="$(shell git ls-remote https://github.com/etesync/etesync-web.git refs/heads/master|cut -f1)"

M4SCRIPT += -DETEBASE_TAG=$(ETEBASE_TAG)
M4SCRIPT += -DETESYNC_WEB_TAG=$(ETESYNC_WEB_TAG)

Dockerfile-force: Dockerfile-force-impl Dockerfile

Dockerfile-force-impl:
touch Dockerfile.in

Dockerfile: Dockerfile.in

build: Dockerfile
docker build .

all: Dockerfile-force build

.PHONY: all build Dockerfile-force Dockerfile-force-impl
8 changes: 8 additions & 0 deletions Makefile.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.SUFFIXES: .in # Add .in as a suffix

M4 = m4
M4FLAGS =
M4SCRIPT =

.in:
${M4} ${M4FLAGS} ${M4SCRIPT} $< > $*