Skip to content

Commit a27c1fb

Browse files
feat: docker setup
1 parent 6bcb619 commit a27c1fb

File tree

6 files changed

+81
-0
lines changed

6 files changed

+81
-0
lines changed

.env.dev.sample

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
DB_USERNAME=postgres
2+
DB_PASSWORD=postgres
3+
DB_HOST=localhost
4+
DB_PORT=5432
5+
DB_NAME=safira_dev
6+
HOST_URL=http://localhost:4000
7+
ASSET_HOST=http://localhost:4000

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,4 @@ safira-*.tar
3737
npm-debug.log
3838
/assets/node_modules/
3939

40+
.env.dev

Dockerfile.dev

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
FROM elixir:1.17-alpine
2+
3+
# Install build dependencies
4+
RUN apk add --no-cache build-base git python3
5+
6+
# Install frontend dependencies
7+
RUN apk add --no-cache nodejs npm
8+
RUN npm install -g npx
9+
10+
# Install pdf generation dependencies
11+
RUN apk add --no-cache \
12+
libstdc++ \
13+
libx11 \
14+
libxrender \
15+
libxext \
16+
libssl3 \
17+
ca-certificates \
18+
fontconfig \
19+
freetype \
20+
ttf-droid \
21+
ttf-freefont \
22+
ttf-liberation \
23+
# more fonts
24+
;
25+
26+
# Install development dependencies
27+
RUN apk add --no-cache inotify-tools
28+
29+
# Install hex + rebar
30+
RUN mix local.hex --force && \
31+
mix local.rebar --force
32+
33+
WORKDIR /app
34+
35+
CMD [ "sh", "-c", "mix setup; mix phx.server" ]

darwin.yml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
services:
2+
db:
3+
ports:
4+
- ${DB_PORT:-5555}:5432
5+
web:
6+
ports:
7+
- ${PORT:-4000}:4000

docker-compose.dev.yml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
services:
2+
db:
3+
image: postgres:14.1
4+
container_name: safira_db
5+
env_file: .env.dev
6+
environment:
7+
POSTGRES_USER: ${DB_USERNAME:-postgres}
8+
POSTGRES_PASSWORD: ${DB_PASSWORD:-postgres}
9+
POSTGRES_HOST: ${DB_HOST:-localhost}
10+
volumes:
11+
- /var/lib/postgresql/data
12+
web:
13+
container_name: safira_web
14+
env_file: .env.dev
15+
environment:
16+
MIX_ENV: ${MIX_ENV:-dev}
17+
build:
18+
context: .
19+
dockerfile: Dockerfile.dev
20+
depends_on:
21+
- db
22+
volumes:
23+
- ./:/app
24+
- /app/_build
25+
- /app/deps
26+
- /app/priv/uploads

linux.yml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
services:
2+
db:
3+
network_mode: "host"
4+
web:
5+
network_mode: "host"

0 commit comments

Comments
 (0)