-
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added Dockerfile and updated README.md accordingly The Dockerfile is a minimal setup to construct a layered docker image, which automatically launches into the nix-shell when executed interactively. The README.md now contains basic instructions about how to build and run the image, although it does not yet specify how to e.g. sync the database files to be persistent or other niceties.
- Loading branch information
Showing
14 changed files
with
153 additions
and
17 deletions.
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,2 @@ | ||
|
||
assets/node_modules |
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 |
---|---|---|
|
@@ -9,17 +9,22 @@ jobs: | |
tests: | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- uses: actions/[email protected] | ||
- name: Local cache | ||
uses: actions/cache@v2 | ||
|
||
- name: Cache install Nix packages | ||
uses: rikhuijzer/[email protected] | ||
with: | ||
path: /nix/store | ||
key: "${{ runner.os }}-nix-cache" | ||
key: nix-${{ hashFiles('default.nix') }} | ||
|
||
- uses: cachix/install-nix-action@v12 | ||
with: | ||
nix_path: nixpkgs=channel:nixos-unstable | ||
|
||
- uses: cachix/cachix-action@v10 | ||
with: | ||
name: flora-pm | ||
|
||
- run: nix-build nix/ci.nix | ||
- run: nix-shell --run "echo OK" | ||
|
||
|
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,21 @@ | ||
# syntax=docker/dockerfile:1 | ||
FROM nixos/nix | ||
|
||
RUN nix-channel --update | ||
RUN nix-env -iA nixpkgs.gnumake | ||
|
||
# generate a working directory | ||
WORKDIR /flora-server | ||
|
||
# copy the files relevant to build core dependencies | ||
COPY default.nix flora.cabal shell.nix environment.sh environment.docker.sh Makefile scripts/start-tmux.sh ./ | ||
COPY nix/ ./nix/ | ||
|
||
# let nix build the dependencies. This uses nix-shell to cache the setup phase. | ||
RUN nix-shell | ||
|
||
# copy asset-relevant dependency files | ||
COPY assets/package.json assets/yarn.lock assets/ | ||
RUN nix-shell --run "make assets-deps" | ||
|
||
CMD [ "/bin/sh", "-c", "sleep 1d"] |
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
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
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,3 @@ | ||
POSTGRES_USER="postgres" | ||
POSTGRES_PASSWORD="postgres" | ||
POSTGRES_DB="flora_dev" |
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
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,25 @@ | ||
version: "3" | ||
services: | ||
flora-server: | ||
build: . | ||
container_name: flora-server | ||
ports: | ||
- "8084:8084" | ||
volumes: | ||
- database-data:/flora-server/pgdata/ | ||
- .:/flora-server:Z | ||
links: | ||
- database | ||
|
||
database: | ||
image: "postgres" | ||
container_name: database | ||
expose: | ||
- "5432" | ||
env_file: | ||
- database.env | ||
volumes: | ||
- database-data:/flora-server/pgdata/ | ||
|
||
volumes: | ||
database-data: |
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,9 @@ | ||
source environment.sh | ||
|
||
export FLORA_DB_HOST="database" | ||
|
||
export FLORA_PG_URI="postgresql://${FLORA_DB_USER}:${FLORA_DB_PASSWORD}@${FLORA_DB_HOST}:${FLORA_DB_PORT}/${FLORA_DB_DATABASE}" | ||
export FLORA_PG_CONNSTRING="host=${FLORA_DB_HOST} dbname=${FLORA_DB_DATABASE} user=${FLORA_DB_USER} password=${FLORA_DB_PASSWORD}" | ||
|
||
|
||
export FLORA_HTTP_PORT=8084 |
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
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,4 +1,4 @@ | ||
import (builtins.fetchTarball { | ||
url = | ||
"https://github.com/NixOS/nixpkgs/archive/2c2a09678ce2ce4125591ac4fe2f7dfaec7a609c.tar.gz"; | ||
"https://github.com/NixOS/nixpkgs/archive/589ce6d8899f9800cb90d85618cf46026a8d784d.tar.gz"; | ||
}) |
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
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,14 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euxo pipefail | ||
|
||
tmux kill-session -t 'flora' || true | ||
tmux new-session -d -s 'flora' | ||
tmux rename-window 'flora' | ||
sleep 1 | ||
tmux send-keys -t "flora" 'make nix-start' 'C-m' | ||
tmux select-window -t flora:0 | ||
sleep 1 | ||
tmux split-window -h 'make assets-watch' | ||
tmux send-keys -t "flora" 'C-b' | ||
tmux attach-session -t flora |
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