Skip to content

Commit de98db2

Browse files
committed
chore: add Dockerfile and compose with postgres for quick setup
1 parent 34e5ae2 commit de98db2

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed

Dockerfile

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Base Java image for building the application
2+
FROM clojure:lein AS build
3+
4+
# Set the working directory
5+
WORKDIR /app
6+
7+
# Copy the project.clj and dependencies files
8+
COPY project.clj /app/
9+
10+
# Download and cache dependencies
11+
RUN lein deps
12+
13+
# Copy the source code and resources
14+
COPY src /app/src
15+
COPY resources /app/resources
16+
17+
# Build the JAR file
18+
RUN lein uberjar
19+
20+
# Base Java image for running the application
21+
FROM openjdk:11-jre-slim AS run
22+
23+
# Set the working directory
24+
WORKDIR /app
25+
26+
# Copy the JAR file and resources from the build image
27+
COPY --from=build /app/target/etlp-mapper-0.1.0-SNAPSHOT-standalone.jar /app/
28+
COPY --from=build /app/resources /app/resources
29+
30+
# Set the default port
31+
ENV PORT=3000
32+
33+
ENV JDBC_URL=${JDBC_URL}
34+
35+
# Expose the port
36+
EXPOSE $PORT
37+
38+
# Run the application
39+
CMD java -jar /app/etlp-mapper-0.1.0-SNAPSHOT-standalone.jar :duct/migrator && \
40+
java -jar /app/etlp-mapper-0.1.0-SNAPSHOT-standalone.jar

docker-compose.yml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
version: "3"
2+
3+
services:
4+
app:
5+
image: "etlp-mapper"
6+
ports:
7+
- "3000:3000"
8+
depends_on:
9+
- db
10+
environment:
11+
JDBC_URL: "jdbc:postgresql://db:5432/mapper?user=postgres&password=postgres"
12+
13+
db:
14+
image: postgres
15+
environment:
16+
POSTGRES_DB: mapper
17+
POSTGRES_USER: postgres
18+
POSTGRES_PASSWORD: postgres
19+
ports:
20+
- "5432:5432"

0 commit comments

Comments
 (0)