Issue #1630: Update Dev Container configuration
- Update Elixer & Phoenix versions. - Update devcontainer configuration to remove deprecated syntax. - Migrate devcontainer-specific setup from Dockerfile to devcontainer feature config in line with current best practice. - Verify able to compile.
This commit is contained in:
@@ -1,63 +1,10 @@
|
|||||||
# Update the VARIANT arg in docker-compose.yml to pick an Elixir version: 1.9, 1.10, 1.10.4
|
# Update the VARIANT arg in docker-compose.yml to pick an Elixir version: 1.9, 1.10, 1.10.4
|
||||||
ARG VARIANT="1.12.3"
|
ARG VARIANT="1.15.8"
|
||||||
FROM elixir:${VARIANT}
|
FROM elixir:${VARIANT}
|
||||||
|
|
||||||
# This Dockerfile adds a non-root user with sudo access. Update the “remoteUser” property in
|
|
||||||
# devcontainer.json to use it. More info: https://aka.ms/vscode-remote/containers/non-root-user.
|
|
||||||
ARG USERNAME=vscode
|
|
||||||
ARG USER_UID=1000
|
|
||||||
ARG USER_GID=$USER_UID
|
|
||||||
|
|
||||||
# Options for common package install script
|
|
||||||
ARG INSTALL_ZSH="true"
|
|
||||||
ARG UPGRADE_PACKAGES="true"
|
|
||||||
ARG COMMON_SCRIPT_SOURCE="https://raw.githubusercontent.com/microsoft/vscode-dev-containers/v0.209.6/script-library/common-debian.sh"
|
|
||||||
ARG COMMON_SCRIPT_SHA="d35dd1711454156c9a59cc41ebe04fbff681ca0bd304f10fd5b13285d0de13b2"
|
|
||||||
|
|
||||||
# Optional Settings for Phoenix
|
|
||||||
ARG PHOENIX_VERSION="1.6.2"
|
|
||||||
|
|
||||||
# [Optional] Setup nodejs
|
|
||||||
ARG NODE_SCRIPT_SOURCE="https://raw.githubusercontent.com/microsoft/vscode-dev-containers/main/script-library/node-debian.sh"
|
|
||||||
ARG NODE_SCRIPT_SHA="dev-mode"
|
|
||||||
ARG NODE_VERSION="none"
|
|
||||||
ENV NVM_DIR=/usr/local/share/nvm
|
|
||||||
ENV NVM_SYMLINK_CURRENT=true
|
|
||||||
ENV PATH=${NVM_DIR}/current/bin:${PATH}
|
|
||||||
|
|
||||||
# [Optional, Choice] Node.js version: none, lts/*, 16, 14, 12, 10
|
|
||||||
ARG NODE_VERSION="none"
|
|
||||||
|
|
||||||
# Install needed packages and setup non-root user. Use a separate RUN statement to add your own dependencies.
|
|
||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
&& export DEBIAN_FRONTEND=noninteractive \
|
&& export DEBIAN_FRONTEND=noninteractive \
|
||||||
&& apt-get -y install --no-install-recommends curl ca-certificates 2>&1 \
|
&& apt-get -y install --no-install-recommends build-essential cmake webp bash libncurses6 git python3 inotify-tools \
|
||||||
&& curl -sSL ${COMMON_SCRIPT_SOURCE} -o /tmp/common-setup.sh \
|
|
||||||
&& ([ "${COMMON_SCRIPT_SHA}" = "dev-mode" ] || (echo "${COMMON_SCRIPT_SHA} */tmp/common-setup.sh" | sha256sum -c -)) \
|
|
||||||
&& /bin/bash /tmp/common-setup.sh "${INSTALL_ZSH}" "${USERNAME}" "${USER_UID}" "${USER_GID}" "${UPGRADE_PACKAGES}" \
|
|
||||||
#
|
|
||||||
# [Optional] Install Node.js for use with web applications
|
|
||||||
&& if [ "$NODE_VERSION" != "none" ]; then \
|
|
||||||
curl -sSL ${NODE_SCRIPT_SOURCE} -o /tmp/node-setup.sh \
|
|
||||||
&& ([ "${NODE_SCRIPT_SHA}" = "dev-mode" ] || (echo "${NODE_SCRIPT_SHA} */tmp/node-setup.sh" | sha256sum -c -)) \
|
|
||||||
&& /bin/bash /tmp/node-setup.sh "${NVM_DIR}" "${NODE_VERSION}" "${USERNAME}"; \
|
|
||||||
fi \
|
|
||||||
#
|
|
||||||
# Install dependencies
|
|
||||||
&& apt-get install -y build-essential \
|
|
||||||
#
|
|
||||||
# Clean up
|
|
||||||
&& apt-get autoremove -y \
|
|
||||||
&& apt-get clean -y \
|
|
||||||
&& rm -rf /var/lib/apt/lists/* /tmp/common-setup.sh /tmp/node-setup.sh
|
|
||||||
|
|
||||||
RUN su ${USERNAME} -c "mix local.hex --force \
|
|
||||||
&& mix local.rebar --force \
|
|
||||||
&& mix archive.install --force hex phx_new ${PHOENIX_VERSION}"
|
|
||||||
|
|
||||||
RUN apt-get update \
|
|
||||||
&& export DEBIAN_FRONTEND=noninteractive \
|
|
||||||
&& apt-get -y install --no-install-recommends cmake webp bash libncurses6 git python3 inotify-tools \
|
|
||||||
&& apt-get autoremove -y \
|
&& apt-get autoremove -y \
|
||||||
&& apt-get clean -y \
|
&& apt-get clean -y \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
|
// For format details, see https://aka.ms/devcontainer.json.
|
||||||
// https://github.com/microsoft/vscode-dev-containers/tree/v0.209.6/containers/elixir-phoenix-postgres
|
|
||||||
{
|
{
|
||||||
"name": "Elixir, Phoenix, Node.js & PostgresSQL (Community)",
|
"name": "Elixir, Phoenix, Node.js & PostgresSQL (Community)",
|
||||||
"dockerComposeFile": "docker-compose.yml",
|
"dockerComposeFile": "docker-compose.yml",
|
||||||
"service": "elixir",
|
"service": "elixir",
|
||||||
"workspaceFolder": "/workspace",
|
"workspaceFolder": "/workspace",
|
||||||
|
|
||||||
// Set *default* container specific settings.json values on container create.
|
// Configure tool-specific properties.
|
||||||
|
"customizations": {
|
||||||
|
"vscode": {
|
||||||
|
// Container specific settings.json values.
|
||||||
"settings": {
|
"settings": {
|
||||||
"sqltools.connections": [
|
"sqltools.connections": [
|
||||||
{
|
{
|
||||||
@@ -21,25 +23,38 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
// VSCode extensions to be automatically installed.
|
||||||
// Add the IDs of extensions you want installed when the container is created.
|
|
||||||
"extensions": [
|
"extensions": [
|
||||||
"jakebecker.elixir-ls",
|
"jakebecker.elixir-ls",
|
||||||
"mtxr.sqltools",
|
"mtxr.sqltools",
|
||||||
"mtxr.sqltools-driver-pg"
|
"mtxr.sqltools-driver-pg"
|
||||||
],
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
||||||
"forwardPorts": [4000, 4001, 5432],
|
"forwardPorts": [4000, 4001, 5432],
|
||||||
|
|
||||||
|
// Features to add to the dev container. More info: https://containers.dev/features.
|
||||||
|
"features": {
|
||||||
|
"ghcr.io/devcontainers/features/common-utils:2": {
|
||||||
|
"installZsh": "true",
|
||||||
|
"username": "vscode",
|
||||||
|
"userUid": "1000",
|
||||||
|
"userGid": "1000",
|
||||||
|
"upgradePackages": "true"
|
||||||
|
},
|
||||||
|
"ghcr.io/devcontainers/features/git:1": {
|
||||||
|
"version": "latest",
|
||||||
|
"ppa": "false"
|
||||||
|
},
|
||||||
|
"ghcr.io/devcontainers/features/node:1": {
|
||||||
|
"version": "20"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
// Use 'postCreateCommand' to run commands after the container is created.
|
// Use 'postCreateCommand' to run commands after the container is created.
|
||||||
// "postCreateCommand": "mix deps.get",
|
"postCreateCommand": "mix local.hex --force && mix local.rebar --force && mix archive.install --force hex phx_new 1.7.18",
|
||||||
// "runArgs": ["--userns=keep-id", "--privileged"],
|
|
||||||
// "containerUser": "vscode",
|
|
||||||
// "containerEnv": {
|
|
||||||
// "HOME": "/home/vscode",
|
|
||||||
// },
|
|
||||||
// "workspaceMount": "source=${localWorkspaceFolder},target=/workspace,type=bind,Z",
|
|
||||||
|
|
||||||
// Uncomment to connect as a non-root user. See https://aka.ms/vscode-remote/containers/non-root.
|
// Uncomment to connect as a non-root user. See https://aka.ms/vscode-remote/containers/non-root.
|
||||||
"remoteUser": "vscode"
|
"remoteUser": "vscode"
|
||||||
|
|||||||
@@ -7,11 +7,7 @@ services:
|
|||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
args:
|
args:
|
||||||
# Elixir Version: 1.9, 1.10, 1.10.4, ...
|
# Elixir Version: 1.9, 1.10, 1.10.4, ...
|
||||||
VARIANT: "1.13.1"
|
VARIANT: "1.15.8"
|
||||||
# Phoenix Version: 1.4.17, 1.5.4, ...
|
|
||||||
PHOENIX_VERSION: "1.6.6"
|
|
||||||
# Node Version: 10, 11, ...
|
|
||||||
NODE_VERSION: "16"
|
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
- ..:/workspace:z
|
- ..:/workspace:z
|
||||||
|
|||||||
Reference in New Issue
Block a user