-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build(docker): mergeable compose files reduce number of files to main…
…tain Instead of writing multiple compose files independently, one basic file and one with the extensions for development can be merged on CLI
- Loading branch information
Showing
6 changed files
with
39 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
{ | ||
"name": "[Optional] Your project name here", | ||
"dockerComposeFile": "../docker-compose-dev.yml", | ||
"dockerComposeFile": ["../docker-compose.yml", "../docker-compose-dev.yml"], | ||
"service": "yggdrasil", | ||
"workspaceFolder": "/opt/app/", | ||
"postCreateCommand": "./gradlew", | ||
"shutdownAction": "stopCompose" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Yggdrasil build configuration | ||
YGGDRASIL_VERSION=0.0.0 | ||
# Build environment preparation | ||
LANG=C.UTF-8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,21 @@ | ||
FROM eclipse-temurin:21 as builder | ||
|
||
# Yggdrasil build configuration | ||
ENV YGGDRASIL_VERSION 0.0.0 | ||
# Enable building specific branches | ||
ARG YGGDRASIL_BRANCH="main" | ||
|
||
# Build environment preparation | ||
ENV LANG C.UTF-8 | ||
|
||
RUN apt update && apt install -y \ | ||
git \ | ||
&& rm -rf /var/cache/apt/archives /var/lib/apt/lists/* | ||
|
||
RUN echo ${YGGDRASIL_BRANCH} | ||
RUN git clone https://github.com/Interactions-HSG/yggdrasil.git \ | ||
--branch $YGGDRASIL_BRANCH \ | ||
# only the specified branch | ||
--depth=1 \ | ||
/opt/app | ||
ADD . /opt/app/ | ||
|
||
WORKDIR /opt/app/ | ||
RUN ./gradlew | ||
|
||
FROM eclipse-temurin:21 | ||
|
||
# Yggdrasil build configuration | ||
ENV YGGDRASIL_VERSION 0.0.0 | ||
RUN apt update && apt install -y \ | ||
git \ | ||
&& rm -rf /var/cache/apt/archives /var/lib/apt/lists/* | ||
|
||
# Build environment preparation | ||
ENV LANG C.UTF-8 | ||
ARG YGGDRASIL_VERSION | ||
|
||
# Copy the jar | ||
RUN mkdir /opt/app | ||
COPY --from=builder /opt/app/build/libs/yggdrasil-${YGGDRASIL_VERSION}-SNAPSHOT-all.jar /opt/app | ||
# Copy the configuration | ||
RUN mkdir /opt/app/conf | ||
# https://stackoverflow.com/a/793867 | ||
RUN mkdir -p /opt/app/conf | ||
COPY --from=builder /opt/app/build/libs/yggdrasil-${YGGDRASIL_VERSION}-SNAPSHOT-all.jar /opt/app/libs/ | ||
COPY --from=builder /opt/app/conf/docker_disk_config.json /opt/app/conf/config.json | ||
|
||
# The default http port | ||
EXPOSE 8080 | ||
# The port for interacting with CArtAgO | ||
EXPOSE 8088 | ||
|
||
ENTRYPOINT java -jar /opt/app/yggdrasil-${YGGDRASIL_VERSION}-SNAPSHOT-all.jar | ||
ENTRYPOINT java -jar /opt/app/libs/yggdrasil-${YGGDRASIL_VERSION}-SNAPSHOT-all.jar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,17 @@ | ||
version: '3.9' | ||
# This file adds extensions needed for development and needs to be merged with docker-compose.yml | ||
# See https://docs.docker.com/compose/multiple-compose-files/merge/ | ||
|
||
services: | ||
yggdrasil: | ||
image: yggdrasil:dev | ||
build: | ||
context: . | ||
dockerfile: Dockerfile_Dev | ||
tty: true | ||
container_name: yggdrasil | ||
# overwrite entrypoint of productive image | ||
entrypoint: ["tail", "-F", "anything"] | ||
container_name: yggdrasil-dev | ||
# Sync changes with host | ||
volumes: | ||
- .:/opt/app/:cached | ||
# # create a project volume to keep work | ||
# # check if git can change line endings automatically | ||
# - .:/opt/app/y:cached | ||
environment: | ||
- YGGDRASIL_VERSION=0.0.0 | ||
- GRADLE_TASK=${GRADLE_TASK} | ||
ports: | ||
- "8899:8080" | ||
- "8900:8088" | ||
- .:/opt/app/:cached # does already exist but https://stackoverflow.com/a/39647631 | ||
# restarting causes problems when using vscode's "Reopne in Container" | ||
restart: "no" | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters