From 9ef10993f23967bb0264c8d8f02d7cbb14f1bf69 Mon Sep 17 00:00:00 2001 From: nsbradford Date: Mon, 30 Oct 2023 16:44:02 -0400 Subject: [PATCH 1/3] add devcontainer --- .devcontainer/devcontainer.json | 58 ++++++++++++++++++++++++++++++++ .github/workflows/playwright.yml | 14 ++++++++ Dockerfile | 32 ++++++++++++++++++ package.json | 4 +-- 4 files changed, 106 insertions(+), 2 deletions(-) create mode 100644 .devcontainer/devcontainer.json create mode 100644 Dockerfile diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..933d913 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,58 @@ +// 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", + + "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", + + + // 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": {} + } + + // Use 'postCreateCommand' to run commands after the container is created. + // TODO yarn install probably should be cached in Dockerfile + // "postCreateCommand": "yarn install", + + // 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" + // ] + // } + // } + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" +} diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index d50554e..afd9db3 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -16,6 +16,7 @@ env: jobs: test: + name: Playwright Tests timeout-minutes: 10 runs-on: ubuntu-latest steps: @@ -38,3 +39,16 @@ jobs: name: playwright-report path: playwright-report/ retention-days: 30 + + build_devcontainer: + name: Build devcontainer + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Build container + run: | + docker build -t devcontainer .devcontainer + # docker run devcontainer + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..7cb607d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,32 @@ +# 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 + +# RUN apk add --no-cache yarn +RUN apt-get update && apt-get install -y \ + python3 \ + make \ + g++ + +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/package.json b/package.json index 60bca43..ff88bf3 100644 --- a/package.json +++ b/package.json @@ -3,14 +3,14 @@ "version": "0.1.0", "private": true, "scripts": { - "dev": "doppler run -- next dev", + "dev": "doppler run --project=talk-form-ai --config=dev -- next dev", "dev-gitpod": "next dev", "build": "next build", "start": "next start", "lint": "next lint", "lint:fix": "yarn lint --fix", "format": "npx prettier --write .", - "test:e2e": "doppler run -- playwright test", + "test:e2e": "doppler run --project=talk-form-ai --config=dev -- playwright test", "test:e2e-gitpod": "playwright test", "generate-db-types": "npx supabase gen types typescript --project-id \"uvthrievvhksvomqwowg\" --schema public > types/supabase.ts" }, From aa44b8af3ec27ad3323748fefee6c7426700f2e5 Mon Sep 17 00:00:00 2001 From: nsbradford Date: Mon, 30 Oct 2023 16:49:07 -0400 Subject: [PATCH 2/3] fix --- .github/workflows/playwright.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index afd9db3..cc5249c 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -40,6 +40,8 @@ jobs: path: playwright-report/ retention-days: 30 + # There isn't an easy way to load the devcontainer itself, + # so we make do with just the dockerfile build_devcontainer: name: Build devcontainer runs-on: ubuntu-latest @@ -49,6 +51,6 @@ jobs: - name: Build container run: | - docker build -t devcontainer .devcontainer + docker build -t devcontainer-instance . # docker run devcontainer From 58a052bbda9d6df1cf90945c5678f3a4504370e9 Mon Sep 17 00:00:00 2001 From: nsbradford Date: Mon, 30 Oct 2023 16:49:34 -0400 Subject: [PATCH 3/3] fix --- .github/workflows/playwright.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index cc5249c..f83b5ec 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -1,4 +1,4 @@ -name: Playwright Tests +name: CI on: push: branches: [main]