diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 531d3cc04..e74fc8f16 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,63 +1,10 @@ # 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} -# 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 \ && export DEBIAN_FRONTEND=noninteractive \ - && apt-get -y install --no-install-recommends curl ca-certificates 2>&1 \ - && 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 -y install --no-install-recommends build-essential cmake webp bash libncurses6 git python3 inotify-tools \ && apt-get autoremove -y \ && apt-get clean -y \ && rm -rf /var/lib/apt/lists/* diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 526e27225..8c0448342 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,45 +1,60 @@ -// 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.209.6/containers/elixir-phoenix-postgres +// For format details, see https://aka.ms/devcontainer.json. { "name": "Elixir, Phoenix, Node.js & PostgresSQL (Community)", "dockerComposeFile": "docker-compose.yml", "service": "elixir", "workspaceFolder": "/workspace", - // Set *default* container specific settings.json values on container create. - "settings": { - "sqltools.connections": [ - { - "name": "Container database", - "driver": "PostgreSQL", - "previewLimit": 50, - "server": "localhost", - "port": 5432, - "database": "postgres", - "username": "postgres", - "password": "postgres" - } - ] + // Configure tool-specific properties. + "customizations": { + "vscode": { + // Container specific settings.json values. + "settings": { + "sqltools.connections": [ + { + "name": "Container database", + "driver": "PostgreSQL", + "previewLimit": 50, + "server": "localhost", + "port": 5432, + "database": "postgres", + "username": "postgres", + "password": "postgres" + } + ] + }, + // VSCode extensions to be automatically installed. + "extensions": [ + "jakebecker.elixir-ls", + "mtxr.sqltools", + "mtxr.sqltools-driver-pg" + ] + } }, - // Add the IDs of extensions you want installed when the container is created. - "extensions": [ - "jakebecker.elixir-ls", - "mtxr.sqltools", - "mtxr.sqltools-driver-pg" - ], - // Use 'forwardPorts' to make a list of ports inside the container available locally. "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. - // "postCreateCommand": "mix deps.get", - // "runArgs": ["--userns=keep-id", "--privileged"], - // "containerUser": "vscode", - // "containerEnv": { - // "HOME": "/home/vscode", - // }, - // "workspaceMount": "source=${localWorkspaceFolder},target=/workspace,type=bind,Z", + "postCreateCommand": "mix local.hex --force && mix local.rebar --force && mix archive.install --force hex phx_new 1.7.18", // Uncomment to connect as a non-root user. See https://aka.ms/vscode-remote/containers/non-root. "remoteUser": "vscode" diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml index bf922850a..f49eb0f08 100644 --- a/.devcontainer/docker-compose.yml +++ b/.devcontainer/docker-compose.yml @@ -7,11 +7,7 @@ services: dockerfile: Dockerfile args: # Elixir Version: 1.9, 1.10, 1.10.4, ... - VARIANT: "1.13.1" - # Phoenix Version: 1.4.17, 1.5.4, ... - PHOENIX_VERSION: "1.6.6" - # Node Version: 10, 11, ... - NODE_VERSION: "16" + VARIANT: "1.15.8" volumes: - ..:/workspace:z