Skip to content

Commit 31f7aa0

Browse files
author
lukwol
committed
Add server service to docker compose
1 parent b87703f commit 31f7aa0

3 files changed

Lines changed: 47 additions & 0 deletions

File tree

.dockerignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Git
2+
.git
3+
4+
# Gleam
5+
**/build
6+
erl_crash.dump

compose.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,27 @@ services:
4646
db:
4747
condition: service_healthy
4848

49+
server:
50+
build:
51+
context: .
52+
dockerfile: server/Dockerfile
53+
restart: unless-stopped
54+
environment:
55+
- ENV
56+
- SECRET_KEY_BASE
57+
- SERVER_HOST
58+
- SERVER_PORT
59+
- PGHOST
60+
- PGPORT
61+
- PGDATABASE
62+
- PGUSER
63+
- PGPASSWORD
64+
ports:
65+
- ${SERVER_PORT}:${SERVER_PORT}
66+
depends_on:
67+
migrate:
68+
condition: service_completed_successfully
69+
4970
volumes:
5071
data:
5172
name: doable-dev-data

server/Dockerfile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
ARG ERLANG_VERSION=27.3.4.10
2+
ARG GLEAM_VERSION=v1.16.0
3+
4+
FROM ghcr.io/gleam-lang/gleam:${GLEAM_VERSION}-scratch AS gleam
5+
6+
FROM erlang:${ERLANG_VERSION}-alpine AS build
7+
COPY --from=gleam /bin/gleam /bin/gleam
8+
WORKDIR /doable/server
9+
COPY shared/gleam.toml /doable/shared/gleam.toml
10+
COPY server/gleam.toml server/manifest.toml ./
11+
RUN gleam deps download
12+
COPY shared/ /doable/shared/
13+
COPY server/ ./
14+
RUN gleam export erlang-shipment
15+
16+
FROM erlang:${ERLANG_VERSION}-alpine
17+
COPY --from=build /doable/server/build/erlang-shipment /doable-server
18+
WORKDIR /doable-server
19+
ENTRYPOINT ["/doable-server/entrypoint.sh"]
20+
CMD ["run"]

0 commit comments

Comments
 (0)