-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
144 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
FROM debian:stretch as base | ||
|
||
ARG DEBIAN_FRONTEND=noninteractive | ||
RUN apt-get update \ | ||
&& apt-get install -y -qq \ | ||
build-essential \ | ||
libssl-dev \ | ||
libcurl4-openssl-dev \ | ||
libxml2-dev \ | ||
libxslt-dev \ | ||
imagemagick \ | ||
ghostscript \ | ||
curl \ | ||
libmagickwand-dev \ | ||
git \ | ||
libpq-dev \ | ||
cmake \ | ||
nodejs \ | ||
# Packages for RVM | ||
gawk \ | ||
libyaml-dev \ | ||
libsqlite3-dev \ | ||
sqlite3 \ | ||
autoconf \ | ||
libgmp-dev \ | ||
libgdbm-dev \ | ||
libncurses5-dev \ | ||
automake \ | ||
bison \ | ||
libffi-dev \ | ||
libgmp-dev \ | ||
libreadline-dev \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
ARG EXT_UID | ||
ARG EXT_GID | ||
RUN addgroup --system --gid ${EXT_GID} diaspora | ||
RUN adduser --system --uid ${EXT_UID} --gid ${EXT_GID} diaspora | ||
|
||
USER diaspora | ||
RUN mkdir /home/diaspora/diaspora | ||
WORKDIR /home/diaspora/diaspora | ||
|
||
# Install RVM + Ruby | ||
ENV LANG=C.UTF8 | ||
|
||
RUN curl -sSL https://rvm.io/mpapis.asc | gpg --import - \ | ||
&& curl -L https://s.diaspora.software/1t | bash \ | ||
&& rm -rf ~/.gnupg | ||
SHELL ["/bin/bash", "--login", "-c"] | ||
|
||
RUN rvm install 2.4 | ||
|
||
# Install bundler | ||
RUN echo diaspora > .ruby-gemset \ | ||
&& echo 2.4 > .ruby-version \ | ||
&& touch Gemfile \ | ||
&& cd ../diaspora \ | ||
&& gem install bundler \ | ||
&& rm .ruby-* Gemfile | ||
|
||
# Finish setup | ||
COPY ./start.sh ../start.sh | ||
|
||
CMD ["../start.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,19 @@ | ||
# diaspora-docker | ||
# diaspora-docker | ||
|
||
This image is intended exclusively for development. | ||
|
||
## Build And Run | ||
|
||
1. Copy `example.env` to `.env` | ||
1. Set `EXT_UID` and `EXT_GID` in `.env` according to your user's user and group ID | ||
1. Execute `docker-compose build diaspora` (takes some time) | ||
1. Copy or link your diaspora code to `./diaspora.docker` | ||
1. Execute `docker-compose up` | ||
|
||
- To restart, do `docker-compose restart diaspora` or (faster) `docker-compose exec diaspora /bin/bash --login -c "bin/eye restart diaspora"` | ||
- To start without migrations and bundle install, set any value for `DIASPORA_DOCKER_DEV_INSTALL_GEMS` and `DIASPORA_DOCKER_DEV_DB_MIGRATE` in `.env`. It is only executed if these variables are empty | ||
|
||
## TODO | ||
|
||
- Control migrations and bundle installing more intuitively | ||
- Create external script for controlling/handling the setup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
version: "3" | ||
|
||
volumes: | ||
postgres_db: | ||
|
||
|
||
services: | ||
|
||
diaspora: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile.diaspora | ||
args: | ||
EXT_UID: "${EXT_UID}" | ||
EXT_GID: "${EXT_GID}" | ||
image: diaspora:dev-latest | ||
environment: | ||
DIASPORA_DOCKER_DEV_INSTALL_GEMS: "${DIASPORA_DOCKER_DEV_INSTALL_GEMS}" | ||
DIASPORA_DOCKER_DEV_DB_MIGRATE: "${DIASPORA_DOCKER_DEV_DB_MIGRATE}" | ||
ports: | ||
- 8080:3000 | ||
volumes: | ||
- ./diaspora.docker:/home/diaspora/diaspora:rw | ||
depends_on: | ||
- postgres | ||
# - redis | ||
|
||
postgres: | ||
image: postgres:9.6 | ||
ports: | ||
- 55432:5432 | ||
volumes: | ||
- postgres_db:/var/lib/postgresql | ||
|
||
# redis: | ||
# image: redis:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
EXT_UID=1000 | ||
EXT_GID=1000 | ||
DIASPORA_DOCKER_DEV_INSTALL_GEMS= | ||
DIASPORA_DOCKER_DEV_DB_MIGRATE= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash --login | ||
|
||
action_install_gems() { | ||
script/configure_bundler | ||
bin/bundle config --local path vendor/bundle | ||
bin/bundle install --full-index | ||
} | ||
|
||
action_db_migrate() { | ||
bin/rake db:create db:migrate | ||
} | ||
|
||
[ -z $DIASPORA_DOCKER_DEV_INSTALL_GEMS ] && action_install_gems | ||
|
||
[ -z $DIASPORA_DOCKER_DEV_DB_MIGRATE ] && action_db_migrate | ||
|
||
[ ! -f public/source.tar.gz ] && touch public/source.tar.gz | ||
|
||
exec ./script/server |