File tree Expand file tree Collapse file tree 3 files changed +34
-0
lines changed Expand file tree Collapse file tree 3 files changed +34
-0
lines changed Original file line number Diff line number Diff line change 1+ services :
2+ sparkjava :
3+ build :
4+ context : sparkjava
5+ target : dev-envs
6+ ports :
7+ - 8080:8080
8+ volumes :
9+ - /var/run/docker.sock:/var/run/docker.sock
Original file line number Diff line number Diff line change @@ -59,3 +59,11 @@ Stopping sparkjava_sparkjava_1 ... done
5959Removing sparkjava_sparkjava_1 ... done
6060Removing network sparkjava_default
6161```
62+
63+ ## Use with Docker Development Environments
64+
65+ You can use this sample with the Dev Environments feature of Docker Desktop.
66+ To develop directly sparkjava service inside containers, you just need to use the https git url of the sample:
67+ ` https://github.com/docker/awesome-compose/tree/master/sparkjava `
68+
69+ ![ page] ( ../dev-envs.png )
Original file line number Diff line number Diff line change 1+ # syntax=docker/dockerfile:1.4
2+
13FROM --platform=$BUILDPLATFORM maven:3.8.5-eclipse-temurin-17 AS build
24WORKDIR /workdir/server
35COPY pom.xml /workdir/server/pom.xml
@@ -7,6 +9,21 @@ COPY src /workdir/server/src
79
810RUN mvn --batch-mode clean compile assembly:single
911
12+ FROM build AS dev-envs
13+ RUN <<EOF
14+ apt-get update
15+ apt-get install -y --no-install-recommends git
16+ EOF
17+
18+ RUN <<EOF
19+ useradd -s /bin/bash -m vscode
20+ groupadd docker
21+ usermod -aG docker vscode
22+ EOF
23+ # install Docker tools (cli, buildx, compose)
24+ COPY --from=gloursdocker/docker / /
25+ CMD ["java" , "-jar" , "target/app.jar" ]
26+
1027FROM eclipse-temurin:17-jre-focal
1128ARG DEPENDENCY=/workdir/server/target
1229EXPOSE 8080
You can’t perform that action at this time.
0 commit comments