From f1bd67b332eea7528535bf942553e2909c3bfee6 Mon Sep 17 00:00:00 2001 From: Mark Pollack Date: Sat, 19 Aug 2023 22:01:02 -0400 Subject: [PATCH] Add devcontainer --- .devcontainer/Dockerfile | 10 +++++++ .devcontainer/devcontainer.json | 36 ++++++++++++++++++++++++ .devcontainer/scripts/onCreateCommand.sh | 6 ++++ 3 files changed, 52 insertions(+) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json create mode 100755 .devcontainer/scripts/onCreateCommand.sh diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 000000000..12a23358a --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,10 @@ +# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/ubuntu/.devcontainer/base.Dockerfile + +# [Choice] Ubuntu version (use ubuntu-22.04 or ubuntu-18.04 on local arm64/Apple Silicon): ubuntu-22.04, ubuntu-20.04, ubuntu-18.04 +ARG VARIANT="jammy" +FROM mcr.microsoft.com/vscode/devcontainers/base:0-${VARIANT} + +RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ + && apt-get -y install --no-install-recommends direnv + + diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 000000000..1df78f8c9 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,36 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: +// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/ubuntu +{ + "name": "acme-fitness-store", + "build": { + "dockerfile": "Dockerfile", + // Update 'VARIANT' to pick an Ubuntu version: jammy / ubuntu-22.04, focal / ubuntu-20.04, bionic /ubuntu-18.04 + // Use ubuntu-22.04 or ubuntu-18.04 on local arm64/Apple Silicon. + "args": { + "VARIANT": "ubuntu-22.04" + } + }, + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + "onCreateCommand": "./.devcontainer/scripts/onCreateCommand.sh", + // Use 'postCreateCommand' to run commands after the container is created. + // Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. + "remoteUser": "vscode", + "hostRequirements": { + "cpus": 2 + }, + "containerEnv": { + "GRADLE_USER_HOME": "/home/vscode", // required because the java feature is not setting this correctly + "M2": "/home/vscode" // required because the java feature is not setting this correctly + }, + "features": { + "azure-cli": "latest", + "docker-from-docker": "latest", + "node": "lts", + "ghcr.io/devcontainers/features/java:1": { + "version": "17", + "installGradle": true, + "installMaven": true + } + } +} \ No newline at end of file diff --git a/.devcontainer/scripts/onCreateCommand.sh b/.devcontainer/scripts/onCreateCommand.sh new file mode 100755 index 000000000..e4aaf8ace --- /dev/null +++ b/.devcontainer/scripts/onCreateCommand.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +set -x + +az extension add --name spring +