Chris Jayden
Chris Jayden
Explore posts from servers
RRailway
Created by Chris Jayden on 9/10/2024 in #✋|help
Listening on port 3000 but no app not availble
That was it lol! Not use to that workflow of saving yet. Thanks Brody!
7 replies
RRailway
Created by Chris Jayden on 9/10/2024 in #✋|help
Help with setting up Turborepo Node application
Also revamped Dockerfile.
# Base stage
FROM node:18-alpine AS base

# Environment variables for pnpm
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"

RUN apk update && apk add --no-cache libc6-compat
RUN corepack enable

# Pruning stage
FROM base AS pruner
WORKDIR /app
COPY . .

# Install Turbo globally
RUN pnpm add -g turbo
RUN turbo prune scan-service --docker

# Development dependencies stage
FROM base AS dev-deps
WORKDIR /app
COPY --from=pruner /app/out/json/ .
COPY --from=pruner /app/out/pnpm-lock.yaml ./pnpm-lock.yaml
RUN pnpm install

# Production dependencies stage
FROM base AS prod-deps
WORKDIR /app
COPY --from=pruner /app/out/json/ .
COPY --from=pruner /app/out/pnpm-lock.yaml ./pnpm-lock.yaml
RUN pnpm install

# Build stage
FROM base AS builder
WORKDIR /app
COPY --from=dev-deps /app/ .
COPY --from=pruner /app/out/full/ .
COPY turbo.json* ./
RUN pnpm turbo run build --filter=scan-service...

# Runner stage
FROM base AS runner
WORKDIR /app
COPY --from=prod-deps /app/ .
COPY --from=builder /app/apps/scan-service/dist/ ./apps/scan-service/dist/

# Expose port 3000
EXPOSE 3000

# Command to run the application
CMD ["pnpm", "start"]
# Base stage
FROM node:18-alpine AS base

# Environment variables for pnpm
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"

RUN apk update && apk add --no-cache libc6-compat
RUN corepack enable

# Pruning stage
FROM base AS pruner
WORKDIR /app
COPY . .

# Install Turbo globally
RUN pnpm add -g turbo
RUN turbo prune scan-service --docker

# Development dependencies stage
FROM base AS dev-deps
WORKDIR /app
COPY --from=pruner /app/out/json/ .
COPY --from=pruner /app/out/pnpm-lock.yaml ./pnpm-lock.yaml
RUN pnpm install

# Production dependencies stage
FROM base AS prod-deps
WORKDIR /app
COPY --from=pruner /app/out/json/ .
COPY --from=pruner /app/out/pnpm-lock.yaml ./pnpm-lock.yaml
RUN pnpm install

# Build stage
FROM base AS builder
WORKDIR /app
COPY --from=dev-deps /app/ .
COPY --from=pruner /app/out/full/ .
COPY turbo.json* ./
RUN pnpm turbo run build --filter=scan-service...

# Runner stage
FROM base AS runner
WORKDIR /app
COPY --from=prod-deps /app/ .
COPY --from=builder /app/apps/scan-service/dist/ ./apps/scan-service/dist/

# Expose port 3000
EXPOSE 3000

# Command to run the application
CMD ["pnpm", "start"]
9 replies
RRailway
Created by Chris Jayden on 9/10/2024 in #✋|help
Help with setting up Turborepo Node application
Fixed it. I removed the Root DIrectoy /apps/scan-service option. And instead set Config-as-code to /apps/scan-service/railway.toml.
[build]
builder = "DOCKERFILE"
dockerfilePath = "apps/scan-service/Dockerfile"

[deploy]
numReplicas = 1
restartPolicyType = "ON_FAILURE"
restartPolicyMaxRetries = 3
healthcheckPath = "/v1/health"
healthcheckTimeout = 50
[build]
builder = "DOCKERFILE"
dockerfilePath = "apps/scan-service/Dockerfile"

[deploy]
numReplicas = 1
restartPolicyType = "ON_FAILURE"
restartPolicyMaxRetries = 3
healthcheckPath = "/v1/health"
healthcheckTimeout = 50
9 replies
RRailway
Created by Chris Jayden on 9/10/2024 in #✋|help
Help with setting up Turborepo Node application
service id: f30f6f38-ab67-479b-9351-8acf06ea91cd
9 replies
RRailway
Created by Chris Jayden on 9/10/2024 in #✋|help
Help with setting up Turborepo Node application
No description
9 replies
RRailway
Created by Chris Jayden on 9/10/2024 in #✋|help
Help with setting up Turborepo Node application
Dockerfile
# Base stage with node:20-slim and pnpm setup
FROM node:20-slim AS base

# Environment variables for pnpm
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"

# Enable corepack to use pnpm
RUN corepack enable

# Install necessary build tools
RUN apt-get update && apt-get install -y \
build-essential \
python3 \
&& rm -rf /var/lib/apt/lists/*

# Builder stage
FROM base AS builder

# Set working directory to the app's directory
WORKDIR /usr/src/app/apps/scan-service

# Copy the entire project (from the perspective of apps/scan-service)
COPY ../.. ../..

# Move to the root directory
WORKDIR /usr/src/app

# Install Turbo globally
RUN pnpm install [email protected] -g

# Install dependencies from the root
RUN pnpm install

# Build the scan-service
RUN turbo run build --filter=scan-service

# Expose port 3000
EXPOSE 3000

# Command to run the application
CMD ["turbo", "run", "start", "--filter=scan-service"]
# Base stage with node:20-slim and pnpm setup
FROM node:20-slim AS base

# Environment variables for pnpm
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"

# Enable corepack to use pnpm
RUN corepack enable

# Install necessary build tools
RUN apt-get update && apt-get install -y \
build-essential \
python3 \
&& rm -rf /var/lib/apt/lists/*

# Builder stage
FROM base AS builder

# Set working directory to the app's directory
WORKDIR /usr/src/app/apps/scan-service

# Copy the entire project (from the perspective of apps/scan-service)
COPY ../.. ../..

# Move to the root directory
WORKDIR /usr/src/app

# Install Turbo globally
RUN pnpm install [email protected] -g

# Install dependencies from the root
RUN pnpm install

# Build the scan-service
RUN turbo run build --filter=scan-service

# Expose port 3000
EXPOSE 3000

# Command to run the application
CMD ["turbo", "run", "start", "--filter=scan-service"]
9 replies