From 2ab19b8d780c111f38e6977b30183f8c39ef0aec Mon Sep 17 00:00:00 2001 From: Amit Singh Date: Tue, 21 Nov 2023 22:15:23 +0530 Subject: [PATCH] Fix/docker (#6) * refactor: cleanup Dockerfile * refactor: fix json * refactor: fix json * refactor: fix Dockerfile * refactor: fix Dockerfile --- .codesandbox/tasks.json | 2 +- .devcontainer/devcontainer.json | 4 +- .tailcallrc.graphql | 69 ++++++++++++++++++++------------- Dockerfile | 14 ++++++- 4 files changed, 56 insertions(+), 33 deletions(-) diff --git a/.codesandbox/tasks.json b/.codesandbox/tasks.json index 6bf6e14..7db0a9a 100644 --- a/.codesandbox/tasks.json +++ b/.codesandbox/tasks.json @@ -6,7 +6,7 @@ "tasks": { "run tailcall": { "name": "run tailcall server", - "command": "ls /workspaces/tailcall-sandbox/exercises/*.graphql | entr -r $HOME/.tailcall/bin/tailcall start $(ls /workspaces/tailcall-sandbox/exercises/*.graphql)", + "command": "ls /workspaces/tailcall-sandbox/exercises/*.graphql | entr -r tailcall start $(ls /workspaces/tailcall-sandbox/exercises/*.graphql)", "runAtStart": true, "preview": { "port": 4000 diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index fe492db..15bd617 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -19,10 +19,10 @@ "label": "Tailcall Playground", "onAutoForward": "openPreview" } - } + }, // Uncomment the next line to run commands after the container is created. - // "postCreateCommand": "cat /etc/os-release", + // "postCreateCommand": "npm i -g @tailcallhq/tailcall" // Configure tool-specific properties. // "customizations": {}, diff --git a/.tailcallrc.graphql b/.tailcallrc.graphql index 413afd4..18e508c 100644 --- a/.tailcallrc.graphql +++ b/.tailcallrc.graphql @@ -1,15 +1,44 @@ directive @server( - enableApolloTracing: Boolean - enableCacheControlHeader: Boolean - enableGraphiql: String - enableIntrospection: Boolean - enableQueryValidation: Boolean - enableResponseValidation: Boolean + apolloTracing: Boolean + cacheControlHeader: Boolean + graphiql: Boolean + introspection: Boolean + queryValidation: Boolean + responseValidation: Boolean + batchRequests: Boolean globalResponseTimeout: Int + workers: Int port: Int vars: [KeyValue] - upstream: Upstream + responseHeaders: [KeyValue] + hostname: String + version: HttpVersion + cert: String + key: String ) on SCHEMA + +enum HttpVersion { + HTTP1 + HTTP2 +} + +directive @upstream( + allowedHeaders: [String] + connectTimeout: Int + keepAliveInterval: Int + keepAliveTimeout: Int + keepAliveWhileIdle: Boolean + poolIdleTimeout: Int + poolMaxIdlePerHost: Int + proxy: Proxy + tcpKeepAlive: Int + timeout: Int + userAgent: String + baseURL: String + httpCache: Boolean + batch: Batch +) on SCHEMA + directive @http( path: String! method: Method = GET @@ -17,11 +46,12 @@ directive @http( body: String baseURL: String headers: [KeyValue] + groupBy: [String!] ) on FIELD_DEFINITION -directive @inline(path: [String]!) on FIELD_DEFINITION +directive @addField(name: String, path: [String]!) on OBJECT directive @modify(omit: Boolean, name: String) on FIELD_DEFINITION -directive @groupBy(path: [String]!, key: String!) on FIELD_DEFINITION -directive @const(data: Json) on FIELD_DEFINITION +directive @groupBy(path: [String!]) on FIELD_DEFINITION +directive @const(data: JSON) on FIELD_DEFINITION enum Method { GET @@ -37,23 +67,6 @@ input Proxy { url: String } -input Upstream { - allowedHeaders: [String] - connect_timeout: Int - keep_alive_interval: Int - keep_alive_timeout: Int - keep_alive_while_idle: Boolean - pool_idle_timeout: Int - pool_max_idle_per_host: Int - proxy: Proxy - tcp_keep_alive: Int - timeout: Int - user_agent: String - base_url: String - enable_http_cache: Boolean - batch: Batch -} - input KeyValue { key: String! value: String! @@ -65,4 +78,4 @@ input Batch { headers: [String] } -scalar Json +scalar JSON diff --git a/Dockerfile b/Dockerfile index 75cebb3..72422ad 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,16 @@ -FROM ubuntu:latest +# Use an official Node.js runtime as a parent image +FROM node:latest + +# Install utilities RUN apt-get update && apt-get install -y curl jq entr + +# Set the working directory WORKDIR /exercises + +# Copy the current directory contents into the container at /exercises COPY ./exercises/. /exercises + +RUN npm install -g @tailcallhq/tailcall + +# Make port 4000 available to the world outside this container EXPOSE 4000 -RUN curl -sSL https://raw.githubusercontent.com/tailcallhq/tailcall/main/install.sh | bash -s \ No newline at end of file