Skip to content

Commit

Permalink
fix: type error
Browse files Browse the repository at this point in the history
  • Loading branch information
Dogtiti committed May 17, 2023
1 parent 65352a4 commit 9baacb5
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 61 deletions.
20 changes: 9 additions & 11 deletions .github/workflows/build-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,18 @@ jobs:
context: .
file: prod.Dockerfile
build-args: |
SKIP_ENV_VALIDATION=1
NEXTAUTH_SECRET: ${NEXTAUTH_SECRET}
NEXTAUTH_URL: ${NEXTAUTH_URL}
DATABASE_URL: ${DATABASE_URL}
NEXTAUTH_URL=http://localhost:3000
DATABASE_URL=file:./db.sqlite
OPENAI_API_KEY: ${OPENAI_API_KEY}
NEXT_PUBLIC_WEB_SEARCH_ENABLED: ${NEXT_PUBLIC_WEB_SEARCH_ENABLED}
SERP_API_KEY: ${SERP_API_KEY}
NEXT_PUBLIC_FF_AUTH_ENABLED: ${NEXT_PUBLIC_FF_AUTH_ENABLED}
GOOGLE_CLIENT_ID: ${GOOGLE_CLIENT_ID}
GOOGLE_CLIENT_SECRET: ${GOOGLE_CLIENT_SECRET}
GITHUB_CLIENT_ID: ${GITHUB_CLIENT_ID}
GITHUB_CLIENT_SECRET: ${GITHUB_CLIENT_SECRET}
DISCORD_CLIENT_ID: ${DISCORD_CLIENT_ID}
DISCORD_CLIENT_SECRET: ${DISCORD_CLIENT_SECRET}
# NEXT_PUBLIC_FF_AUTH_ENABLED: ${NEXT_PUBLIC_FF_AUTH_ENABLED}
# GOOGLE_CLIENT_ID: ${GOOGLE_CLIENT_ID}
# GOOGLE_CLIENT_SECRET: ${GOOGLE_CLIENT_SECRET}
# GITHUB_CLIENT_ID: ${GITHUB_CLIENT_ID}
# GITHUB_CLIENT_SECRET: ${GITHUB_CLIENT_SECRET}
# DISCORD_CLIENT_ID: ${DISCORD_CLIENT_ID}
# DISCORD_CLIENT_SECRET: ${DISCORD_CLIENT_SECRET}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
5 changes: 5 additions & 0 deletions dev.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ FROM node:19-alpine

RUN apk update && apk add --no-cache openssl

ARG NEXTAUTH_SECRET=$(openssl rand -base64 32)
ENV NEXTAUTH_SECRET=$NEXTAUTH_SECRET

ARG DATABASE_URL
ENV DATABASE_URL=$DATABASE_URL
Expand All @@ -28,6 +30,9 @@ COPY . .
# Prevent Husky errors by disabling the `prepare` script
RUN npm pkg set scripts.prepare="exit 0"

# set npm registry
RUN npm config set registry 'https://registry.npmmirror.com/'

RUN \
if [ -f yarn.lock ]; then yarn --frozen-lockfile; \
elif [ -f package-lock.json ]; then npm ci; \
Expand Down
5 changes: 2 additions & 3 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ services:
context: .
dockerfile: dev.Dockerfile
args:
NEXTAUTH_SECRET: ${NEXTAUTH_SECRET}
NEXTAUTH_URL: ${NEXTAUTH_URL}
DATABASE_URL: ${DATABASE_URL}
NEXTAUTH_URL: http://localhost:3000
DATABASE_URL: file:./db.sqlite
SKIP_ENV_VALIDATION: 1 # omit this property to enable schema validation for the environment variables
container_name: autogpt
environment:
Expand Down
33 changes: 18 additions & 15 deletions docker-compose.prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,24 @@ version: '3'
services:
autogpt:
container_name: autogpt
image: dogtititi/autogpt-next-web:latest
args:
NEXTAUTH_SECRET: ${NEXTAUTH_SECRET}
NEXTAUTH_URL: ${NEXTAUTH_URL}
DATABASE_URL: ${DATABASE_URL}
OPENAI_API_KEY: ${OPENAI_API_KEY} # openai api key
NEXT_PUBLIC_WEB_SEARCH_ENABLED: ${NEXT_PUBLIC_WEB_SEARCH_ENABLED} # enable web search
SERP_API_KEY: ${SERP_API_KEY} # serp api key
NEXT_PUBLIC_FF_AUTH_ENABLED: ${NEXT_PUBLIC_FF_AUTH_ENABLED} # auth enable
GOOGLE_CLIENT_ID: ${GOOGLE_CLIENT_ID} # google client id
GOOGLE_CLIENT_SECRET: ${GOOGLE_CLIENT_SECRET} # google client secret
GITHUB_CLIENT_ID: ${GITHUB_CLIENT_ID} # github client id
GITHUB_CLIENT_SECRET: ${GITHUB_CLIENT_SECRET} # github client secret
DISCORD_CLIENT_ID: ${DISCORD_CLIENT_ID} # discord client id
DISCORD_CLIENT_SECRET: ${DISCORD_CLIENT_SECRET} # discord client secret
# image: dogtititi/autogpt-next-web:latest
build:
context: .
dockerfile: prod.Dockerfile
args:
NEXTAUTH_URL: http://localhost:3000
DATABASE_URL: file:./db.sqlite
OPENAI_API_KEY: ${OPENAI_API_KEY} # openai api key
NEXT_PUBLIC_WEB_SEARCH_ENABLED: true # enable web search
SERP_API_KEY: ${SERP_API_KEY} # serp api key
NEXT_PUBLIC_GUEST_KEY: 123 # guest key
# NEXT_PUBLIC_FF_AUTH_ENABLED: ${NEXT_PUBLIC_FF_AUTH_ENABLED} false # auth enable
# GOOGLE_CLIENT_ID: ${GOOGLE_CLIENT_ID} # google client id
# GOOGLE_CLIENT_SECRET: ${GOOGLE_CLIENT_SECRET} # google client secret
# GITHUB_CLIENT_ID: ${GITHUB_CLIENT_ID} # github client id
# GITHUB_CLIENT_SECRET: ${GITHUB_CLIENT_SECRET} # github client secret
# DISCORD_CLIENT_ID: ${DISCORD_CLIENT_ID} # discord client id
# DISCORD_CLIENT_SECRET: ${DISCORD_CLIENT_SECRET} # discord client secret
ports:
- 3000:3000
restart: unless-stopped
70 changes: 38 additions & 32 deletions prod.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ FROM node:19-alpine AS base
# Step 1. Rebuild the source code only when needed
FROM base AS builder

RUN apk update && apk add --no-cache openssl

WORKDIR /app

# Install dependencies based on the preferred package manager
Expand All @@ -12,6 +14,9 @@ COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./
# Prevent Husky errors by disabling the `prepare` script
RUN npm pkg set scripts.prepare="exit 0"

# set npm registry
RUN npm config set registry 'https://registry.npmmirror.com/'

# Omit --production flag for TypeScript devDependencies
RUN \
if [ -f yarn.lock ]; then yarn --frozen-lockfile; \
Expand All @@ -27,14 +32,13 @@ COPY . .
# Environment variables must be present at build time
# https://github.com/vercel/next.js/discussions/14030

ARG SKIP_ENV_VALIDATION
ENV SKIP_ENV_VALIDATION=$SKIP_ENV_VALIDATION
ARG NEXTAUTH_SECRET=$(openssl rand -base64 32)
ENV NEXTAUTH_SECRET=$NEXTAUTH_SECRET


ARG DATABASE_URL
ENV DATABASE_URL=$DATABASE_URL

ARG NEXTAUTH_SECRET
ENV NEXTAUTH_SECRET=$NEXTAUTH_SECRET

ARG NEXTAUTH_URL
ENV NEXTAUTH_URL=$NEXTAUTH_URL
Expand All @@ -51,28 +55,30 @@ ENV SERP_API_KEY=$SERP_API_KEY
ARG NEXT_PUBLIC_GUEST_KEY
ENV NEXT_PUBLIC_GUEST_KEY=$NEXT_PUBLIC_GUEST_KEY

ARG NEXT_PUBLIC_FF_AUTH_ENABLED
ENV NEXT_PUBLIC_FF_AUTH_ENABLED=$NEXT_PUBLIC_FF_AUTH_ENABLED
# ARG NEXT_PUBLIC_FF_AUTH_ENABLED
# ENV NEXT_PUBLIC_FF_AUTH_ENABLED=$NEXT_PUBLIC_FF_AUTH_ENABLED

ARG GOOGLE_CLIENT_ID
ENV GOOGLE_CLIENT_ID=$GOOGLE_CLIENT_ID
# ARG GOOGLE_CLIENT_ID
# ENV GOOGLE_CLIENT_ID=$GOOGLE_CLIENT_ID

ARG GOOGLE_CLIENT_SECRET
ENV GOOGLE_CLIENT_SECRET=$GOOGLE_CLIENT_SECRET
# ARG GOOGLE_CLIENT_SECRET
# ENV GOOGLE_CLIENT_SECRET=$GOOGLE_CLIENT_SECRET

ARG GITHUB_CLIENT_ID
ENV GITHUB_CLIENT_ID=$GITHUB_CLIENT_ID
# ARG GITHUB_CLIENT_ID
# ENV GITHUB_CLIENT_ID=$GITHUB_CLIENT_ID

ARG GITHUB_CLIENT_SECRET
ENV GITHUB_CLIENT_SECRET=$GITHUB_CLIENT_SECRET
# ARG GITHUB_CLIENT_SECRET
# ENV GITHUB_CLIENT_SECRET=$GITHUB_CLIENT_SECRET

ARG DISCORD_CLIENT_ID
ENV DISCORD_CLIENT_ID=$DISCORD_CLIENT_ID
# ARG DISCORD_CLIENT_ID
# ENV DISCORD_CLIENT_ID=$DISCORD_CLIENT_ID

# Next.js collects completely anonymous telemetry data about general usage. Learn more here: https://nextjs.org/telemetry
# Uncomment the following line to disable telemetry at build time
# ENV NEXT_TELEMETRY_DISABLED 1

ENTRYPOINT ["sh", "entrypoint.sh"]

# Build Next.js based on the preferred package manager
RUN \
if [ -f yarn.lock ]; then yarn build; \
Expand Down Expand Up @@ -102,14 +108,14 @@ COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static


# Environment variables must be redefined at run time
ARG SKIP_ENV_VALIDATION
ENV SKIP_ENV_VALIDATION=$SKIP_ENV_VALIDATION

ARG NEXTAUTH_SECRET=$(openssl rand -base64 32)
ENV NEXTAUTH_SECRET=$NEXTAUTH_SECRET


ARG DATABASE_URL
ENV DATABASE_URL=$DATABASE_URL

ARG NEXTAUTH_SECRET
ENV NEXTAUTH_SECRET=$NEXTAUTH_SECRET

ARG NEXTAUTH_URL
ENV NEXTAUTH_URL=$NEXTAUTH_URL
Expand All @@ -127,23 +133,23 @@ ENV SERP_API_KEY=$SERP_API_KEY
ARG NEXT_PUBLIC_GUEST_KEY
ENV NEXT_PUBLIC_GUEST_KEY=$NEXT_PUBLIC_GUEST_KEY

ARG NEXT_PUBLIC_FF_AUTH_ENABLED
ENV NEXT_PUBLIC_FF_AUTH_ENABLED=$NEXT_PUBLIC_FF_AUTH_ENABLED
# ARG NEXT_PUBLIC_FF_AUTH_ENABLED
# ENV NEXT_PUBLIC_FF_AUTH_ENABLED=$NEXT_PUBLIC_FF_AUTH_ENABLED

ARG GOOGLE_CLIENT_ID
ENV GOOGLE_CLIENT_ID=$GOOGLE_CLIENT_ID
# ARG GOOGLE_CLIENT_ID
# ENV GOOGLE_CLIENT_ID=$GOOGLE_CLIENT_ID

ARG GOOGLE_CLIENT_SECRET
ENV GOOGLE_CLIENT_SECRET=$GOOGLE_CLIENT_SECRET
# ARG GOOGLE_CLIENT_SECRET
# ENV GOOGLE_CLIENT_SECRET=$GOOGLE_CLIENT_SECRET

ARG GITHUB_CLIENT_ID
ENV GITHUB_CLIENT_ID=$GITHUB_CLIENT_ID
# ARG GITHUB_CLIENT_ID
# ENV GITHUB_CLIENT_ID=$GITHUB_CLIENT_ID

ARG GITHUB_CLIENT_SECRET
ENV GITHUB_CLIENT_SECRET=$GITHUB_CLIENT_SECRET
# ARG GITHUB_CLIENT_SECRET
# ENV GITHUB_CLIENT_SECRET=$GITHUB_CLIENT_SECRET

ARG DISCORD_CLIENT_ID
ENV DISCORD_CLIENT_ID=$DISCORD_CLIENT_ID
# ARG DISCORD_CLIENT_ID
# ENV DISCORD_CLIENT_ID=$DISCORD_CLIENT_ID

# Uncomment the following line to disable telemetry at run time
# ENV NEXT_TELEMETRY_DISABLED 1
Expand Down

0 comments on commit 9baacb5

Please sign in to comment.