Add a devcontainer config, maybe? Prob garbage.
This commit is contained in:
parent
e7fa392951
commit
e8e8316f4e
41
.devcontainer/Dockerfile
Normal file
41
.devcontainer/Dockerfile
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
# Update the VARIANT arg in docker-compose.yml to pick an Elixir version: 1.9, 1.10, 1.10.4
|
||||||
|
ARG VARIANT="1.17.2"
|
||||||
|
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"
|
||||||
|
|
||||||
|
# Optional Settings for Phoenix
|
||||||
|
ARG PHOENIX_VERSION="1.7.12"
|
||||||
|
|
||||||
|
# [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="21.7.3"
|
||||||
|
|
||||||
|
# Install needed packages and setup non-root user. Use a separate RUN statement to add your own dependencies.
|
||||||
|
|
||||||
|
RUN su ${USERNAME} -c "mix local.hex --force \
|
||||||
|
&& mix local.rebar --force \
|
||||||
|
&& mix archive.install --force hex phx_new ${PHOENIX_VERSION}"
|
||||||
|
|
||||||
|
# [Optional] Uncomment this section to install additional OS packages.
|
||||||
|
RUN apt-get update \
|
||||||
|
&& export DEBIAN_FRONTEND=noninteractive \
|
||||||
|
&& apt-get -y install --no-install-recommends postgresql-client inotify-tools
|
||||||
|
|
||||||
|
# [Optional] Uncomment this line to install additional package.
|
||||||
|
# RUN mix ...
|
25
.devcontainer/devcontainer.json
Normal file
25
.devcontainer/devcontainer.json
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
// 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.231.5/containers/elixir-phoenix-postgres
|
||||||
|
{
|
||||||
|
"name": "Elixir/Phoenix",
|
||||||
|
"dockerComposeFile": "docker-compose.yml",
|
||||||
|
"service": "elixir",
|
||||||
|
"workspaceFolder": "/workspace",
|
||||||
|
|
||||||
|
// Set *default* container specific settings.json values on container create.
|
||||||
|
"settings": {},
|
||||||
|
|
||||||
|
// Add the IDs of extensions you want installed when the container is created.
|
||||||
|
"extensions": [
|
||||||
|
],
|
||||||
|
|
||||||
|
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
||||||
|
// This can be used to network with other containers or with the host.
|
||||||
|
"forwardPorts": [4000, 4001, 5432],
|
||||||
|
|
||||||
|
// Use 'postCreateCommand' to run commands after the container is created.
|
||||||
|
"postCreateCommand": "mix deps.get"
|
||||||
|
|
||||||
|
// Uncomment to connect as a non-root user. See https://aka.ms/vscode-remote/containers/non-root.
|
||||||
|
"remoteUser": "vscode"
|
||||||
|
}
|
35
.devcontainer/docker-compose.yml
Normal file
35
.devcontainer/docker-compose.yml
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
version: "3.8"
|
||||||
|
|
||||||
|
services:
|
||||||
|
elixir:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
args:
|
||||||
|
# Elixir Version: 1.9, 1.10, 1.10.4, ...
|
||||||
|
VARIANT: "1.16.2"
|
||||||
|
# Phoenix Version: 1.4.17, 1.5.4, ...
|
||||||
|
PHOENIX_VERSION: "1.7.12"
|
||||||
|
# Node Version: 12, 14, ...
|
||||||
|
NODE_VERSION: "21.7.3"
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
- ..:/workspace:cached
|
||||||
|
# Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function.
|
||||||
|
network_mode: service:db
|
||||||
|
|
||||||
|
# Overrides default command so things don't shut down after the process ends.
|
||||||
|
command: sleep infinity
|
||||||
|
|
||||||
|
db:
|
||||||
|
image: postgres:latest
|
||||||
|
restart: unless-stopped
|
||||||
|
volumes:
|
||||||
|
- postgres-data:/var/lib/postgresql/data
|
||||||
|
environment:
|
||||||
|
POSTGRES_USER: postgres
|
||||||
|
POSTGRES_PASSWORD: postgres
|
||||||
|
POSTGRES_DB: todo_dev
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
postgres-data:
|
Loading…
Reference in a new issue