Skip to content

Commit

Permalink
chore: devcontainer
Browse files Browse the repository at this point in the history
  • Loading branch information
guesant committed Nov 23, 2024
1 parent 24f99ef commit 86e0262
Show file tree
Hide file tree
Showing 11 changed files with 126 additions and 55 deletions.
38 changes: 38 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-docker-compose
{
"name": "Existing Docker Compose (Extend)",

// Update the 'dockerComposeFile' list if you have more compose files or use different names.
// The .devcontainer/docker-compose.yml file contains any overrides you need/want to make.
"dockerComposeFile": ["../docker-compose.yml", "docker-compose.yml"],

// The 'service' property is the name of the service for the container that VS Code should
// use. Update this value and .devcontainer/docker-compose.yml to the real service name.
"service": "ladesa-ro-sso-development",

// The optional 'workspaceFolder' property is the path VS Code should open by default when
// connected. This is typically a file mount in .devcontainer/docker-compose.yml
"workspaceFolder": "/workspace",

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Uncomment the next line if you want start specific services in your Docker Compose config.
// "runServices": [],

// Uncomment the next line if you want to keep your containers running after VS Code shuts down.
"shutdownAction": "stopCompose",

// Uncomment the next line to run commands after the container is created.
// "postCreateCommand": "cat /etc/os-release",

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root.
"remoteUser": "r2d2"
}
25 changes: 25 additions & 0 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
version: "3.8"
services:
# Update this to the name of the service you want to work with in your docker-compose.yml file
ladesa-ro-sso-development:
# Uncomment if you want to override the service's Dockerfile to one in the .devcontainer
# folder. Note that the path of the Dockerfile and context is relative to the *primary*
# docker-compose.yml file (the first in the devcontainer.json "dockerComposeFile"
# array). The sample below assumes your primary file is in the root of your project.
#
# build:
# context: .
# dockerfile: .devcontainer/Dockerfile

volumes:
# Update this to wherever you want VS Code to mount the folder of your project
- .:/workspace:cached

# Uncomment the next four lines if you will use a ptrace-based debugger like C++, Go, and Rust.
# cap_add:
# - SYS_PTRACE
# security_opt:
# - seccomp:unconfined

# Overrides default command so things don't shut down after the process ends.
command: sleep infinity
File renamed without changes.
19 changes: 12 additions & 7 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
node_modules
.git
.github
.devcontainer
.devops

.gitignore
*.md
dist
.dockerignore

Dockerfile
.vitepress/cache
.github
.development
.devops
docker-compose.yml

node_modules
dist

*.md
2 changes: 1 addition & 1 deletion .github/actions/deploy-k8s/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ runs:
echo "${HELM_RELEASE_VALUES}" | helm upgrade -i ${HELM_RELEASE_NAME} ${GENERIC_CHART_NAME} \
--namespace=${K8S_NAMESPACE} \
--values=./values.common.yml \
--values=./.devops/values.common.yml \
-f - \
;
Expand Down
2 changes: 1 addition & 1 deletion .kc.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ KC_DB_URL_HOST=ladesa-ro-sso-db
KC_DB_URL_PORT=5432
KC_DB_URL_DATABASE=ladesa-ro-sso

KC_DB_SCHEMA=keycloak
KC_DB_SCHEMA=public
KC_DB_USERNAME=postgres
KC_DB_PASSWORD=5fc445f63b0b4cf388d0e772e053d468

Expand Down
28 changes: 19 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
FROM node:23 AS sso-development
FROM debian:bookworm AS sso-development

RUN apt-get update && \
apt-get install -y openjdk-17-jdk && \
apt-get install -y maven;
RUN apt-get update;

ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
RUN apt-get install -y sudo git zsh wget vim;

RUN apt-get install -y openjdk-17-jdk maven;

ARG USERNAME=r2d2
ARG USER_UID=1000
ARG USER_GID=$USER_UID

RUN groupadd --gid ${USER_GID} ${USERNAME};
RUN adduser --uid ${USER_UID} --gid ${USER_GID} --shell /bin/zsh --home /home/r2d2 $USERNAME;
RUN echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME

# ********************************************************
# * Anything else you want to do like clean up goes here *
# ********************************************************

USER node
USER $USERNAME

WORKDIR /var/lib/ladesa-ro/ctx
RUN wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh || true

# ================================================================== #
# Builder of theme jars #
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
d_network=ladesa-net
d_container_app=ladesa-ro-sso

compose_options=--file .development/docker-compose.yml -p ladesa-ro-sso
compose_options=--file docker-compose.yml -p ladesa-ro-sso

setup:
$(shell (cd .development; find . -type f -name "*.example" -exec sh -c 'cp -n {} $$(basename {} .example)' \;))
$(shell (cd .; find . -type f -name "*.example" -exec sh -c 'cp -n {} $$(basename {} .example)' \;))
$(shell (bash -c "docker network create $(d_network) &>/dev/null"))

up:
Expand Down
63 changes: 28 additions & 35 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,58 +1,34 @@
services:
ladesa-ro-sso-db:
image: bitnami/postgresql:15
container_name: ladesa-ro-sso-db

volumes:
- "ladesa-ro-sso-db-data:/bitnami/postgresql"
- "./volumes/db/scripts/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d"

env_file:
- .kc-db.env

networks:
ladesa-net:

ports:
- 23080:5432

ladesa-ro-sso-theme:
container_name: ladesa-ro-sso-theme

ladesa-ro-sso-development:
hostname: devcontainer
container_name: ladesa-ro-sso-development
working_dir: /workspace
build:
context: ./images/development

context: ./
target: sso-development
command: tail -f /dev/null

volumes:
- ./:/var/lib/ladesa-ro/ctx
- ./:/workspace

ladesa-ro-sso:
container_name: ladesa-ro-sso

build:
context: ../
context: ./
target: sso-builder
args:
- KEYCLOAK_EXTRA_ARGS=-Dkeycloak.profile.feature.scripts=enabled

entrypoint: /opt/keycloak/bin/kc.sh
command: start-dev --import-realm

env_file:
- .kc.env

volumes:
- ./data/import:/opt/keycloak/data/import/

- ./services/sso/import:/opt/keycloak/data/import/
depends_on:
- ladesa-ro-sso-db

networks:
ladesa-net:

ports:
- 23032:5432

- 23032:8080
labels:
# ===================================================================
- "traefik.enable=true"
Expand All @@ -70,6 +46,23 @@ services:
- "traefik.http.routers.sso-insecure.service=sso"
# ===================================================================

ladesa-ro-sso-db:
image: bitnami/postgresql:15
container_name: ladesa-ro-sso-db

volumes:
- "ladesa-ro-sso-db-data:/bitnami/postgresql"
- "./.devcontainer/volumes/db/scripts/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d"

env_file:
- .kc-db.env

networks:
ladesa-net:

# ports:
# - 23080:5432

networks:
ladesa-net:
external: true
Expand Down
File renamed without changes.

0 comments on commit 86e0262

Please sign in to comment.