Skip to content

Commit 7489665

Browse files
committed
Fix up building for docker compose
1 parent 52e3c65 commit 7489665

14 files changed

Lines changed: 60 additions & 12 deletions

README.md

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,20 +38,33 @@ Slack does **not** support localhost or http protocol.
3838

3939
If you are not running with auth then localhost is fine.
4040

41+
## Local running with docker compose
42+
43+
You will need to provide the same environment variables as above in a file called `local.env` in the root directory.
44+
45+
Note - this file is also useful when running from Idea with the envfile plugin.
46+
47+
This file MUST NOT be committed to git (it is in .gitignore).
48+
4149
## Deploy
4250

4351
Assuming we will build a docker container - add to [backend action](./.github/workflows/backend.yaml) when decided.
4452

45-
Currently it is setup for the frontend to proxy the backend - anything on `/api/*`, as well as `/login` and `/slackCallback`
53+
Currently it is setup for the frontend to proxy the backend - anything on `/api/*`, as well as `/login` and
54+
`/slackCallback`
4655

4756
For example - let's say we setup:
4857

4958
https://cupcake_backend.javazone.no -> backend
5059
https://cupcake.javazone.no -> frontend
5160

52-
We need to set the host in the frontend for non development builds to `https://cupcake_backend.javazone.no` in the [nuxt.config.js](./frontend/nuxt.config.js) file.
61+
We would then need to set the host in the frontend for non development builds to `https://cupcake_backend.javazone.no` in
62+
the [proxy](./frontend/server/middleware/proxy.ts) file - but this is set using the CUPCAKE_BACKEND env var.
63+
64+
All app configuration for the backend is done via the environment.
5365

54-
App configuration for the backend is done via the environment.
66+
If deploying with docker - you can place both on the same docker network and use the service name for the env var - see
67+
[docker-compose.yml](./docker-compose.yml) for an example.
5568

5669
### JWT
5770

@@ -76,7 +89,8 @@ We use the same user and password for dev and deploy here but it must be set in
7689

7790
This provides login and access checking.
7891

79-
We can use the same slack client for dev and deploy but we have to set the correct callback URL both in the environment AND in the slack app config on https://api.slack.com
92+
We can use the same slack client for dev and deploy but we have to set the correct callback URL both in the environment
93+
AND in the slack app config on https://api.slack.com
8094

8195
SLACK_CLIENT
8296
SLACK_SECRET
File renamed without changes.

backend/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ FROM eclipse-temurin:22-jre AS deploy
88

99
WORKDIR /opt/app
1010
COPY --from=build /build/build/libs/cupcake.jar /opt/app
11+
1112
CMD ["java", "-jar", "/opt/app/cupcake.jar"]

backend/build.gradle.kts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ dependencies {
4949
}
5050

5151
tasks.shadowJar {
52+
dependsOn(tasks.startScripts)
5253
archiveFileName.set("cupcake.jar")
5354
}
5455

@@ -66,4 +67,12 @@ tasks.test {
6667

6768
tasks.jacocoTestReport {
6869
dependsOn(tasks.test)
70+
}
71+
72+
tasks.named("distZip") {
73+
dependsOn(tasks.shadowJar)
74+
}
75+
76+
tasks.named("distTar") {
77+
dependsOn(tasks.shadowJar)
6978
}

backend/gradle.properties

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1-
version=0.0.2
1+
kotlin.code.style=official
2+
org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=1g
3+
4+
org.gradle.configuration-cache=true
5+
org.gradle.parallel=true
6+
org.gradle.caching=true
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)