Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add devcontainer #911

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .devcontainer/backend-container/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "Momentum Mod API",
"dockerComposeFile": [
"../../docker-compose.yml",
"../../docker-compose.override.yml",
"../docker-compose.devcontainer.yml"
],
"service": "api",
"shutdownAction": "none",
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
"features": {
"ghcr.io/devcontainers-contrib/features/nx-npm:1": {}
},
"customizations": {
"vscode": {
"extensions": [
"nrwl.angular-console",
"esbenp.prettier-vscode",
"firsttris.vscode-jest-runner",
"dbaeumer.vscode-eslint"
]
}
},
"forwardPorts": [3000],
"initializeCommand": [".devcontainer/init"],
"postCreateCommand": "git config --global --add safe.directory ${containerWorkspaceFolder} && git config --global --add safe.directory ${containerWorkspaceFolder}/apps/frontend/src/app/theme/shared_styling && git submodule update --init",
"postStartCommand": "npm install && nx run db:push && nx run db:seed && npm run serve:backend"
}
27 changes: 27 additions & 0 deletions .devcontainer/docker-compose.devcontainer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
version: '3.8'

services:
app:
image: mcr.microsoft.com/devcontainers/typescript-node
volumes:
- ../:/workspaces:cached
command: sleep infinity
env_file:
- .env
depends_on:
- minio
- db
- createbuckets
- api
api:
image: mcr.microsoft.com/devcontainers/typescript-node
volumes:
- ../:/workspaces:cached
command: sleep infinity
environment:
IS_DOCKERIZED_API: 'true'
DATABASE_URL: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db/${POSTGRES_DB}?schema=public
depends_on:
- minio
- db
- createbuckets
28 changes: 28 additions & 0 deletions .devcontainer/frontend-container/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "Momentum Mod Website",
"dockerComposeFile": [
"../../docker-compose.yml",
"../../docker-compose.override.yml",
"../docker-compose.devcontainer.yml"
],
"service": "app",
"shutdownAction": "none",
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
"features": {
"ghcr.io/devcontainers-contrib/features/nx-npm:1": {}
},
"customizations": {
"vscode": {
"extensions": [
"nrwl.angular-console",
"esbenp.prettier-vscode",
"firsttris.vscode-jest-runner",
"dbaeumer.vscode-eslint"
]
}
},
"forwardPorts": [4200],
"initializeCommand": [".devcontainer/init"],
"postCreateCommand": "git config --global --add safe.directory ${containerWorkspaceFolder} && git config --global --add safe.directory ${containerWorkspaceFolder}/apps/frontend/src/app/theme/shared_styling && git submodule update --init",
"postStartCommand": "npm install && npm run serve:frontend"
}
3 changes: 3 additions & 0 deletions .devcontainer/init
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

cp -n -p env.TEMPLATE .env
1 change: 1 addition & 0 deletions .devcontainer/init.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
IF NOT EXIST .env COPY /-y env.TEMPLATE .env
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.git
*Dockerfile*
*docker-compose*
node_modules
data
dist
.nx
4 changes: 3 additions & 1 deletion libs/db/src/scripts/seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,9 @@ prismaWrapper(async (prisma: PrismaClient) => {
}[];
const s3 = new S3Client({
region: process.env['STORAGE_REGION'],
endpoint: process.env['STORAGE_ENDPOINT_URL'],
endpoint: process.env['IS_DOCKERIZED_API']
? process.env['STORAGE_ENDPOINT_URL_DOCKERIZED']
: process.env['STORAGE_ENDPOINT_URL'],
credentials: {
accessKeyId: process.env['STORAGE_ACCESS_KEY_ID'],
secretAccessKey: process.env['STORAGE_SECRET_ACCESS_KEY']
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
"license": "MIT",
"scripts": {
"postinstall": "nx run db:generate",
"prepare": "husky install"
"prepare": "husky install",
"serve:backend": "nx serve backend",
alexwaibel marked this conversation as resolved.
Show resolved Hide resolved
"serve:frontend": "nx serve frontend"
},
"dependencies": {
"@angular/animations": "17.0.4",
Expand Down
Loading