Skip to content

Commit

Permalink
Merge pull request #111 from nsbradford/nick10-30-add_devcontainer
Browse files Browse the repository at this point in the history
add devcontainer
  • Loading branch information
nsbradford authored Oct 30, 2023
2 parents 110a18a + 58a052b commit 83beaa9
Show file tree
Hide file tree
Showing 4 changed files with 109 additions and 3 deletions.
58 changes: 58 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -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"
}
18 changes: 17 additions & 1 deletion .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Playwright Tests
name: CI
on:
push:
branches: [main]
Expand All @@ -16,6 +16,7 @@ env:

jobs:
test:
name: Playwright Tests
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
Expand All @@ -38,3 +39,18 @@ jobs:
name: playwright-report
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
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Build container
run: |
docker build -t devcontainer-instance .
# docker run devcontainer <your-test-command>

32 changes: 32 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down

0 comments on commit 83beaa9

Please sign in to comment.