Skip to content

Commit

Permalink
Add docker
Browse files Browse the repository at this point in the history
  • Loading branch information
boozec committed Mar 24, 2024
1 parent cddf4a9 commit 312b7f5
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
24 changes: 24 additions & 0 deletions api/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM ocaml/opam:debian-12-ocaml-5.1 as build
WORKDIR /build

# Install dependencies.
RUN sudo apt-get update
RUN sudo apt-get install -y libev-dev libpq-dev pkg-config

COPY . .

RUN opam install --deps-only .

# Build project.
RUN opam exec -- dune build



FROM debian:bookworm-slim as run

RUN apt-get update
RUN apt-get install -y libev4 libpq5 libssl3

COPY --from=build /build/_build/default/bin/main.exe /bin/acmebank

ENTRYPOINT /bin/acmebank
28 changes: 28 additions & 0 deletions api/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
version: '3'
services:
postgres:
image: postgres:16-alpine
container_name: bankservice-postgres
restart: always
environment:
- POSTGRES_DB=${POSTGRES_DB}
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
volumes:
- postgres-data:/var/lib/postgresql/data
networks:
- default

bankservice-api:
image: acmesky-bankservice-api
container_name: bankservice-api
environment:
- DATABASE_URL=${DATABASE_URL}
depends_on:
- postgres
ports:
- "8080:8080"
restart: unless-stopped

volumes:
postgres-data:

0 comments on commit 312b7f5

Please sign in to comment.