Skip to content

Commit

Permalink
initial pass at a dev container.
Browse files Browse the repository at this point in the history
Signed-off-by: Mike Cobbett <[email protected]>
  • Loading branch information
techcobweb committed Feb 1, 2024
1 parent f98328d commit 2cefd5c
Show file tree
Hide file tree
Showing 7 changed files with 85 additions and 1 deletion.
11 changes: 11 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM ubuntu:jammy

RUN apt-get update \
&& apt-get install -y curl wget unzip zip

RUN apt-get update \
&& apt-get install -y fontconfig libfreetype6

RUN mkdir -p /workspace
WORKDIR /workspace

32 changes: 32 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"name": "Galasa CLI devcontainer",
"build": {
"dockerfile": "Dockerfile"
},
"features": {
"ghcr.io/devcontainers/features/git:1": {},
"ghcr.io/devcontainers/features/common-utils:2": {},
"ghcr.io/devcontainers/features/go:1": {
"version": "1.19.1"
},
"ghcr.io/devcontainers/features/java:1": {
"version": "11.0.18-sem",
"jdkDistro": "sem",
"installGradle" : true,
"gradleVersion": "6.9.2",
"installMaven": true,
"mavenVersion": "3.8.6"
}
},
"forwardPorts": [9080,9443],
"privileged": true,
"remoteUser": "${localEnv:USER}",
"workspaceMount": "source=${localWorkspaceFolder},target=/workspaces/,type=bind",
"workspaceFolder": "/workspace",
"postStartCommand": "git config --global --add safe.directory /workspace",
"mounts": [
"source=${localEnv:HOME}/.galasa,target=/root/.galasa,type=bind,consistency=cached",
"source=${localEnv:HOME}/.m2,target=/root/.m2,type=bind,consistency=cached"
],
"postCreateCommand": "./.devcontainer/setup-env.sh"
}
12 changes: 12 additions & 0 deletions .devcontainer/setup-env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

# Go get the public IBM certificates and install them
curl -k -o carootcert.der https://ibmca-prod.dal.cpc.ibm.com:9443/cybersecurity/ibmcert/web/downloadCarootCert.do?file=carootcert.der
curl -k -o caintermediatecert.der https://ibmca-prod.dal.cpc.ibm.com:9443/cybersecurity/ibmcert/web/downloadCarootCert.do?file=caintermediatecert.der

cp carootcert.der $JAVA_HOME/lib/security
cp caintermediatecert.der $JAVA_HOME/lib/security

cd $JAVA_HOME/lib/security;
keytool -keystore cacerts -storepass changeit -noprompt -trustcacerts -importcert -alias ibmca -file carootcert.der
keytool -keystore cacerts -storepass changeit -noprompt -trustcacerts -importcert -alias ibminter -file caintermediatecert.der

12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for more information:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
# https://containers.dev/guide/dependabot

version: 2
updates:
- package-ecosystem: "devcontainers"
directory: "/"
schedule:
interval: weekly
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,8 @@ pkg/embedded/templates/version/build.properties
# The galasaapi package is generated.
pkg/galasaapi/

*.directory
.attach_pid807

# Don't check-in certificates
*.der
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ galasactl: \

# 'gendocs-galasactl' is a command-line tool which generates documentation about the galasactl tool.
# When executed, the .md produced contain up-to-date information on tool syntax.
gendocs-galasactl: bin/gendocs-galasactl-darwin-arm64 bin/gendocs-galasactl-darwin-x86_64 bin/gendocs-galasactl-linux-x86_64
gendocs-galasactl: bin/gendocs-galasactl-darwin-arm64 bin/gendocs-galasactl-linux-arm64 bin/gendocs-galasactl-darwin-x86_64 bin/gendocs-galasactl-linux-x86_64

tests: galasactl-source build/coverage.txt build/coverage.html

Expand Down Expand Up @@ -93,6 +93,9 @@ bin/galasactl-linux-s390x : galasactl-source
bin/gendocs-galasactl-darwin-arm64 : galasactl-source
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -o bin/gendocs-galasactl-darwin-arm64 ./cmd/gendocs-galasactl

bin/gendocs-galasactl-linux-arm64 : galasactl-source
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o bin/gendocs-galasactl-linux-arm64 ./cmd/gendocs-galasactl

bin/gendocs-galasactl-linux-x86_64 : galasactl-source
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o bin/gendocs-galasactl-linux-x86_64 ./cmd/gendocs-galasactl

Expand Down
9 changes: 9 additions & 0 deletions build-locally.sh
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,11 @@ function calculate_galasactl_executable {
esac

architecture=$(uname -m)
case $architecture in
aarch64)
architecture="arm64"
;;
esac

export galasactl_command="galasactl-${os}-${architecture}"
info "galasactl command is ${galasactl_command}"
Expand Down Expand Up @@ -448,7 +453,11 @@ function generate_galasactl_documentation {
*) error "Unknown machine type ${unameOut}"
exit 1
esac

architecture="$(uname -m)"
case $architecture in
aarch64) architecture=arm64
esac

# Call the documentation generator, which builds .md files
info "Using program ${BASEDIR}/bin/gendocs-galasactl-${machine}-${architecture} to generate the documentation..."
Expand Down

0 comments on commit 2cefd5c

Please sign in to comment.