From 3c75dc99b83037348838fee0501fe5b589329896 Mon Sep 17 00:00:00 2001 From: nsbradford Date: Tue, 31 Oct 2023 14:23:11 -0400 Subject: [PATCH 1/3] new devcontainer for codespaces --- .devcontainer/codespaces/Dockerfile | 33 ++++++++++ .devcontainer/codespaces/devcontainer.json | 65 ++++++++++++++++++++ Dockerfile => .devcontainer/local/Dockerfile | 0 .devcontainer/{ => local}/devcontainer.json | 3 +- 4 files changed, 100 insertions(+), 1 deletion(-) create mode 100644 .devcontainer/codespaces/Dockerfile create mode 100644 .devcontainer/codespaces/devcontainer.json rename Dockerfile => .devcontainer/local/Dockerfile (100%) rename .devcontainer/{ => local}/devcontainer.json (95%) diff --git a/.devcontainer/codespaces/Dockerfile b/.devcontainer/codespaces/Dockerfile new file mode 100644 index 0000000..41f5221 --- /dev/null +++ b/.devcontainer/codespaces/Dockerfile @@ -0,0 +1,33 @@ +# Use the specified image +# this had trouble with the `yarn install` +# FROM mcr.microsoft.com/devcontainers/typescript-node:1-18-bullseye +# FROM node:18.15.0-alpine +FROM node:18.15.0-bullseye-slim + +# codespaces automatically clones the repo into /workspaces/ +# WORKDIR /app + +# necessary for some of the npm packages +RUN apt-get update && apt-get install -y \ + python3 \ + make \ + g++ + +# https://docs.doppler.com/docs/install-cli +RUN apt-get update && apt-get install -y apt-transport-https ca-certificates curl gnupg && \ + curl -sLf --retry 3 --tlsv1.2 --proto "=https" 'https://packages.doppler.com/public/cli/gpg.DE2A7741A397C129.key' | gpg --dearmor -o /usr/share/keyrings/doppler-archive-keyring.gpg && \ + echo "deb [signed-by=/usr/share/keyrings/doppler-archive-keyring.gpg] https://packages.doppler.com/public/cli/deb/debian any-version main" | tee /etc/apt/sources.list.d/doppler-cli.list && \ + apt-get update && \ + apt-get -y install doppler + +# codespaces automatically clones the repo into /workspaces/ +# COPY package.json yarn.lock ./ + +# codespaces automatically clones the repo into /workspaces/ +RUN yarn install --frozen-lockfile + +# Copy the rest of the project files into the working directory +# COPY . . + +# Expose the port your app runs on +EXPOSE 3000 \ No newline at end of file diff --git a/.devcontainer/codespaces/devcontainer.json b/.devcontainer/codespaces/devcontainer.json new file mode 100644 index 0000000..7f8de38 --- /dev/null +++ b/.devcontainer/codespaces/devcontainer.json @@ -0,0 +1,65 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/typescript-node +{ + "name": "TalkForm", + + // NOTE: because codespaces automatically + "dockerFile": "Dockerfile.codespaces", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + // "image": "mcr.microsoft.com/devcontainers/typescript-node:1-18-bullseye", + + + // https://community.doppler.com/t/vscode-container-support/104 + // https://community.doppler.com/t/doppler-and-github-codespaces/989/2 + "containerEnv": { + "DOPPLER_TOKEN": "${localEnv:DOPPLER_CLI_TOKEN}" + }, + + // "features": { + // "ghcr.io/devcontainers-contrib/features/supabase-cli:1": {} + // }, + + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, + + // "settings": { + // "terminal.integrated.shell.linux": "/bin/bash" + // }, + + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [ + 3000 + ], + "features": { + "ghcr.io/devcontainers/features/git:1": {} + }, + + "portsAttributes": { + "3000": { + "label": "website" + } + }, + + // TODO can't get the yarn install within Dockerfile to show up in dev container + // "postCreateCommand": "yarn install --frozen-lockfile", + + // Configure tool-specific properties. + "customizations": { + "vscode": { + "settings": {}, + "extensions": [ + "dbaeumer.vscode-eslint", + "eamodio.gitlens", + "esbenp.prettier-vscode", + "GitHub.copilot", + "k--kato.intellij-idea-keybindings", + "Orta.vscode-jest", + "ms-azuretools.vscode-docker" + ] + } + } + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" +} diff --git a/Dockerfile b/.devcontainer/local/Dockerfile similarity index 100% rename from Dockerfile rename to .devcontainer/local/Dockerfile diff --git a/.devcontainer/devcontainer.json b/.devcontainer/local/devcontainer.json similarity index 95% rename from .devcontainer/devcontainer.json rename to .devcontainer/local/devcontainer.json index cd655ba..245e575 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/local/devcontainer.json @@ -3,7 +3,8 @@ { "name": "TalkForm", - "dockerFile": "../Dockerfile", + // NOTE: because codespaces automatically + "dockerFile": "Dockerfile.codespaces", // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile // "image": "mcr.microsoft.com/devcontainers/typescript-node:1-18-bullseye", From 001f814ff05405fa5af01ce729fcf7190735ca6c Mon Sep 17 00:00:00 2001 From: nsbradford Date: Tue, 31 Oct 2023 19:03:53 +0000 Subject: [PATCH 2/3] eh --- .devcontainer/codespaces/Dockerfile | 33 ---------------------- .devcontainer/codespaces/devcontainer.json | 7 +++-- .devcontainer/local/Dockerfile | 33 ---------------------- .devcontainer/local/devcontainer.json | 2 +- 4 files changed, 5 insertions(+), 70 deletions(-) delete mode 100644 .devcontainer/codespaces/Dockerfile delete mode 100644 .devcontainer/local/Dockerfile diff --git a/.devcontainer/codespaces/Dockerfile b/.devcontainer/codespaces/Dockerfile deleted file mode 100644 index 41f5221..0000000 --- a/.devcontainer/codespaces/Dockerfile +++ /dev/null @@ -1,33 +0,0 @@ -# Use the specified image -# this had trouble with the `yarn install` -# FROM mcr.microsoft.com/devcontainers/typescript-node:1-18-bullseye -# FROM node:18.15.0-alpine -FROM node:18.15.0-bullseye-slim - -# codespaces automatically clones the repo into /workspaces/ -# WORKDIR /app - -# necessary for some of the npm packages -RUN apt-get update && apt-get install -y \ - python3 \ - make \ - g++ - -# https://docs.doppler.com/docs/install-cli -RUN apt-get update && apt-get install -y apt-transport-https ca-certificates curl gnupg && \ - curl -sLf --retry 3 --tlsv1.2 --proto "=https" 'https://packages.doppler.com/public/cli/gpg.DE2A7741A397C129.key' | gpg --dearmor -o /usr/share/keyrings/doppler-archive-keyring.gpg && \ - echo "deb [signed-by=/usr/share/keyrings/doppler-archive-keyring.gpg] https://packages.doppler.com/public/cli/deb/debian any-version main" | tee /etc/apt/sources.list.d/doppler-cli.list && \ - apt-get update && \ - apt-get -y install doppler - -# codespaces automatically clones the repo into /workspaces/ -# COPY package.json yarn.lock ./ - -# codespaces automatically clones the repo into /workspaces/ -RUN yarn install --frozen-lockfile - -# Copy the rest of the project files into the working directory -# COPY . . - -# Expose the port your app runs on -EXPOSE 3000 \ No newline at end of file diff --git a/.devcontainer/codespaces/devcontainer.json b/.devcontainer/codespaces/devcontainer.json index 7f8de38..06cc85e 100644 --- a/.devcontainer/codespaces/devcontainer.json +++ b/.devcontainer/codespaces/devcontainer.json @@ -4,7 +4,7 @@ "name": "TalkForm", // NOTE: because codespaces automatically - "dockerFile": "Dockerfile.codespaces", + "dockerFile": "../../Dockerfile.codespaces", // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile // "image": "mcr.microsoft.com/devcontainers/typescript-node:1-18-bullseye", @@ -41,8 +41,9 @@ } }, - // TODO can't get the yarn install within Dockerfile to show up in dev container - // "postCreateCommand": "yarn install --frozen-lockfile", + // TODO can't get the yarn install within Dockerfile to show up in dev container. + // This also seems to be what the Microsoft example devcontainers do. + "postCreateCommand": "yarn install --frozen-lockfile", // Configure tool-specific properties. "customizations": { diff --git a/.devcontainer/local/Dockerfile b/.devcontainer/local/Dockerfile deleted file mode 100644 index 86ea5d2..0000000 --- a/.devcontainer/local/Dockerfile +++ /dev/null @@ -1,33 +0,0 @@ -# Use the specified image -# this had trouble with the `yarn install` -# FROM mcr.microsoft.com/devcontainers/typescript-node:1-18-bullseye -# FROM node:18.15.0-alpine -FROM node:18.15.0-bullseye-slim - -# Set the working directory -WORKDIR /app - -# necessary for some of the npm packages -RUN apt-get update && apt-get install -y \ - python3 \ - make \ - g++ - -# https://docs.doppler.com/docs/install-cli -RUN apt-get update && apt-get install -y apt-transport-https ca-certificates curl gnupg && \ - curl -sLf --retry 3 --tlsv1.2 --proto "=https" 'https://packages.doppler.com/public/cli/gpg.DE2A7741A397C129.key' | gpg --dearmor -o /usr/share/keyrings/doppler-archive-keyring.gpg && \ - echo "deb [signed-by=/usr/share/keyrings/doppler-archive-keyring.gpg] https://packages.doppler.com/public/cli/deb/debian any-version main" | tee /etc/apt/sources.list.d/doppler-cli.list && \ - apt-get update && \ - apt-get -y install doppler - -# Copy package.json and yarn.lock into the working directory -COPY package.json yarn.lock ./ - -# Install dependencies using yarn -RUN yarn install --frozen-lockfile - -# Copy the rest of the project files into the working directory -COPY . . - -# Expose the port your app runs on -EXPOSE 3000 \ No newline at end of file diff --git a/.devcontainer/local/devcontainer.json b/.devcontainer/local/devcontainer.json index 245e575..8f44ecb 100644 --- a/.devcontainer/local/devcontainer.json +++ b/.devcontainer/local/devcontainer.json @@ -4,7 +4,7 @@ "name": "TalkForm", // NOTE: because codespaces automatically - "dockerFile": "Dockerfile.codespaces", + "dockerFile": "../../Dockerfile.full", // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile // "image": "mcr.microsoft.com/devcontainers/typescript-node:1-18-bullseye", From c76326bc91da299775ec8229fb7b3b4f27331a8b Mon Sep 17 00:00:00 2001 From: nsbradford Date: Tue, 31 Oct 2023 15:11:35 -0400 Subject: [PATCH 3/3] fix --- .../{codespaces => }/devcontainer.json | 2 +- .devcontainer/local/deprecated-Dockerfile | 33 +++++++++++++++++++ ...iner.json => deprecated-devcontainer.json} | 0 Dockerfile | 33 +++++++++++++++++++ 4 files changed, 67 insertions(+), 1 deletion(-) rename .devcontainer/{codespaces => }/devcontainer.json (97%) create mode 100644 .devcontainer/local/deprecated-Dockerfile rename .devcontainer/local/{devcontainer.json => deprecated-devcontainer.json} (100%) create mode 100644 Dockerfile diff --git a/.devcontainer/codespaces/devcontainer.json b/.devcontainer/devcontainer.json similarity index 97% rename from .devcontainer/codespaces/devcontainer.json rename to .devcontainer/devcontainer.json index 06cc85e..972285a 100644 --- a/.devcontainer/codespaces/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -4,7 +4,7 @@ "name": "TalkForm", // NOTE: because codespaces automatically - "dockerFile": "../../Dockerfile.codespaces", + "dockerFile": "../Dockerfile", // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile // "image": "mcr.microsoft.com/devcontainers/typescript-node:1-18-bullseye", diff --git a/.devcontainer/local/deprecated-Dockerfile b/.devcontainer/local/deprecated-Dockerfile new file mode 100644 index 0000000..86ea5d2 --- /dev/null +++ b/.devcontainer/local/deprecated-Dockerfile @@ -0,0 +1,33 @@ +# Use the specified image +# this had trouble with the `yarn install` +# FROM mcr.microsoft.com/devcontainers/typescript-node:1-18-bullseye +# FROM node:18.15.0-alpine +FROM node:18.15.0-bullseye-slim + +# Set the working directory +WORKDIR /app + +# necessary for some of the npm packages +RUN apt-get update && apt-get install -y \ + python3 \ + make \ + g++ + +# https://docs.doppler.com/docs/install-cli +RUN apt-get update && apt-get install -y apt-transport-https ca-certificates curl gnupg && \ + curl -sLf --retry 3 --tlsv1.2 --proto "=https" 'https://packages.doppler.com/public/cli/gpg.DE2A7741A397C129.key' | gpg --dearmor -o /usr/share/keyrings/doppler-archive-keyring.gpg && \ + echo "deb [signed-by=/usr/share/keyrings/doppler-archive-keyring.gpg] https://packages.doppler.com/public/cli/deb/debian any-version main" | tee /etc/apt/sources.list.d/doppler-cli.list && \ + apt-get update && \ + apt-get -y install doppler + +# Copy package.json and yarn.lock into the working directory +COPY package.json yarn.lock ./ + +# Install dependencies using yarn +RUN yarn install --frozen-lockfile + +# Copy the rest of the project files into the working directory +COPY . . + +# Expose the port your app runs on +EXPOSE 3000 \ No newline at end of file diff --git a/.devcontainer/local/devcontainer.json b/.devcontainer/local/deprecated-devcontainer.json similarity index 100% rename from .devcontainer/local/devcontainer.json rename to .devcontainer/local/deprecated-devcontainer.json diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..41f5221 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,33 @@ +# Use the specified image +# this had trouble with the `yarn install` +# FROM mcr.microsoft.com/devcontainers/typescript-node:1-18-bullseye +# FROM node:18.15.0-alpine +FROM node:18.15.0-bullseye-slim + +# codespaces automatically clones the repo into /workspaces/ +# WORKDIR /app + +# necessary for some of the npm packages +RUN apt-get update && apt-get install -y \ + python3 \ + make \ + g++ + +# https://docs.doppler.com/docs/install-cli +RUN apt-get update && apt-get install -y apt-transport-https ca-certificates curl gnupg && \ + curl -sLf --retry 3 --tlsv1.2 --proto "=https" 'https://packages.doppler.com/public/cli/gpg.DE2A7741A397C129.key' | gpg --dearmor -o /usr/share/keyrings/doppler-archive-keyring.gpg && \ + echo "deb [signed-by=/usr/share/keyrings/doppler-archive-keyring.gpg] https://packages.doppler.com/public/cli/deb/debian any-version main" | tee /etc/apt/sources.list.d/doppler-cli.list && \ + apt-get update && \ + apt-get -y install doppler + +# codespaces automatically clones the repo into /workspaces/ +# COPY package.json yarn.lock ./ + +# codespaces automatically clones the repo into /workspaces/ +RUN yarn install --frozen-lockfile + +# Copy the rest of the project files into the working directory +# COPY . . + +# Expose the port your app runs on +EXPOSE 3000 \ No newline at end of file