Skip to content

Commit 1f0c839

Browse files
Chore: Add devcontainer env
1 parent 8318fc5 commit 1f0c839

File tree

6 files changed

+14
-24
lines changed

6 files changed

+14
-24
lines changed

.github/.devcontainer/devcontainer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@
131131
},
132132
"postCreateCommand": "bash .devcontainer/scripts/post-create.sh",
133133
"onCreateCommand": "bash .devcontainer/scripts/setup-dotnet-dev-cert.sh",
134+
"postAttachCommand": "bash -i .devcontainer/scripts/post-attach.sh",
134135
"remoteUser": "vscode",
135136
"features": {
136137
"ghcr.io/devcontainers/features/common-utils:2": {

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,4 +104,5 @@ wp-config.php
104104

105105
# Custom rules (everything added below won't be overriden by 'Generate .gitignore File' if you use 'Update' option)
106106
.env
107+
devcontainer.env
107108
.vscode/

docker-compose.yml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
services:
22
app:
3+
env_file: devcontainer.env
34
platform: linux/arm64
4-
image: ghcr.io/nziswano/wordpress-dev:latest
5+
image: ghcr.io/nziswano/wp-devcontainer:latest
56
volumes:
67
- ..:/workspace:cached
78
- vscode-extension-wp:/vscode/.vscode-server/extensions
89
command: sleep infinity
910
network_mode: service:wordpressdb
1011
depends_on:
1112
- wordpressdb
12-
env_file:
13-
- .env
1413
environment:
1514
- WORDPRESS_DB_HOST=${WORDPRESS_DB_HOST}
1615
- WORDPRESS_DB_USER=${WORDPRESS_DB_USER}
@@ -34,18 +33,11 @@ services:
3433
volumes:
3534
- ./scripts/test-db.sql:/docker-entrypoint-initdb.d/test-db.sql
3635
- mariadb-data:/var/lib/mysql
37-
environment:
38-
MARIADB_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
39-
MARIADB_USER: ${MYSQL_USER}
40-
MARIADB_PASSWORD: ${MYSQL_PASSWORD}
41-
MARIADB_DATABASE: ${MYSQL_DATABASE}
4236
adminer:
4337
platform: linux/arm64
4438
image: adminer
4539
ports:
4640
- 9090:9090
47-
env_file:
48-
- .env
4941
civicrm:
5042
hostname: example
5143
image: civicrm/civicrm:latest

scripts/post-attach.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
set -xe
3+
if git config --global gpg.ssh.program; then
4+
echo "Unsetting gpg.ssh.program"
5+
git config --global --unset gpg.ssh.program
6+
git config --global --add safe.directory /workspace
7+
fi

scripts/post-create.sh

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,4 @@
11
#!/usr/bin/env zsh
22
set -xe
3-
nvm install --lts
3+
. ${NVM_DIR}/nvm.sh && nvm install --lts --latest-npm --default --save
44
npm install -g typescript prettier prettier aws-cdk
5-
npm cache clean
6-
git config --global pull.rebase true
7-
git config --global --add safe.directory /workspace
8-
git config --global user.name "Johan Martin"
9-
git config --global user.email "jnm+johanmartindev@catenare.com"
10-
git config --global gpg.format ssh && git config --global user.signingkey "$SSH_SIGNING_KEY"
11-
git config --global commit.gpgsign true
12-
if git config --global gpg.ssh.program; then
13-
echo "Unsetting gpg.ssh.program"
14-
git config --global --unset gpg.ssh.program
15-
fi

scripts/setup-dotnet-dev-cert.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env bash
2-
2+
set -xe
33
# Change ownership of the .dotnet directory to the vscode user (to avoid permission errors)
44
sudo chown -R vscode:vscode /home/vscode/.dotnet
55

@@ -10,4 +10,4 @@ dotnet dev-certs https
1010
sudo -E dotnet dev-certs https --export-path /usr/local/share/ca-certificates/dotnet-dev-cert.crt --format pem
1111

1212
# Add the PEM file to the trust store
13-
sudo update-ca-certificates
13+
sudo update-ca-certificates

0 commit comments

Comments
 (0)