materwelon
materwelon
Explore posts from servers
RRailway
Created by materwelon on 10/12/2024 in #✋|help
Need help building and deploying monorepo on railway
thanks for trying to help Brody :smil:
111 replies
RRailway
Created by materwelon on 10/12/2024 in #✋|help
Need help building and deploying monorepo on railway
decided to use two repos instead of one :yescat: we won the hackathon tho!
111 replies
RRailway
Created by materwelon on 10/12/2024 in #✋|help
Need help building and deploying monorepo on railway
back finally :Pray:
# Stage 1: Build the Frontend
FROM node:22-alpine AS builder

ARG API_URL
ARG RAILWAY_ENVIRONMENT
ARG RAILWAY_SERVICE_NAME

# Set working directory
WORKDIR /app

# Install pnpm globally
RUN npm install -g pnpm

# Copy root package.json, pnpm-workspace.yaml, and pnpm-lock.yaml
COPY package.json pnpm-workspace.yaml pnpm-lock.yaml ./

# Install all dependencies
RUN pnpm install

# Copy all workspace packages (includes API, Backend, Frontend)
COPY . .

# Build the Frontend
RUN pnpm --filter frontend run build

# Stage 2: Serve with Nginx
FROM nginx:alpine

# Install gettext for envsubst (environment variable substitution)
RUN apk add --no-cache gettext

# Copy custom Nginx configuration template
COPY Frontend/nginx.conf.template /etc/nginx/nginx.conf.template

# Copy entrypoint script
COPY Frontend/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

# Remove default Nginx static assets
RUN rm -rf /usr/share/nginx/html/*

# Copy built Frontend code from builder
COPY --from=builder /app/Frontend/dist /usr/share/nginx/html

# Expose port 80
EXPOSE 80

# Set entrypoint to handle dynamic configuration and start Nginx
ENTRYPOINT ["/entrypoint.sh"]
# Stage 1: Build the Frontend
FROM node:22-alpine AS builder

ARG API_URL
ARG RAILWAY_ENVIRONMENT
ARG RAILWAY_SERVICE_NAME

# Set working directory
WORKDIR /app

# Install pnpm globally
RUN npm install -g pnpm

# Copy root package.json, pnpm-workspace.yaml, and pnpm-lock.yaml
COPY package.json pnpm-workspace.yaml pnpm-lock.yaml ./

# Install all dependencies
RUN pnpm install

# Copy all workspace packages (includes API, Backend, Frontend)
COPY . .

# Build the Frontend
RUN pnpm --filter frontend run build

# Stage 2: Serve with Nginx
FROM nginx:alpine

# Install gettext for envsubst (environment variable substitution)
RUN apk add --no-cache gettext

# Copy custom Nginx configuration template
COPY Frontend/nginx.conf.template /etc/nginx/nginx.conf.template

# Copy entrypoint script
COPY Frontend/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

# Remove default Nginx static assets
RUN rm -rf /usr/share/nginx/html/*

# Copy built Frontend code from builder
COPY --from=builder /app/Frontend/dist /usr/share/nginx/html

# Expose port 80
EXPOSE 80

# Set entrypoint to handle dynamic configuration and start Nginx
ENTRYPOINT ["/entrypoint.sh"]
111 replies
RRailway
Created by materwelon on 10/12/2024 in #✋|help
Need help building and deploying monorepo on railway
i should probs test locally with docker first
111 replies
RRailway
Created by materwelon on 10/12/2024 in #✋|help
Need help building and deploying monorepo on railway
it needs fixing :D_lol:
111 replies
RRailway
Created by materwelon on 10/12/2024 in #✋|help
Need help building and deploying monorepo on railway
have not deployed
111 replies
RRailway
Created by materwelon on 10/12/2024 in #✋|help
Need help building and deploying monorepo on railway
well, service.
111 replies
RRailway
Created by materwelon on 10/12/2024 in #✋|help
Need help building and deploying monorepo on railway
oh btw, got perms for github and connected it to the railway project.
111 replies
RRailway
Created by materwelon on 10/12/2024 in #✋|help
Need help building and deploying monorepo on railway
yes it's static during build time
111 replies
RRailway
Created by materwelon on 10/12/2024 in #✋|help
Need help building and deploying monorepo on railway
it's all frontend
111 replies
RRailway
Created by materwelon on 10/12/2024 in #✋|help
Need help building and deploying monorepo on railway
there are no backend enpoints that send anything to the website during build
111 replies
RRailway
Created by materwelon on 10/12/2024 in #✋|help
Need help building and deploying monorepo on railway
yeah, it doesnt
111 replies
RRailway
Created by materwelon on 10/12/2024 in #✋|help
Need help building and deploying monorepo on railway
the website isn't fetching any data from the backend when it starts btw. atleast right now. So API_URL isn't needed either, really.
111 replies
RRailway
Created by materwelon on 10/12/2024 in #✋|help
Need help building and deploying monorepo on railway
It doesnt need it in the current state
111 replies
RRailway
Created by materwelon on 10/12/2024 in #✋|help
Need help building and deploying monorepo on railway
oh well, i shouldnt step ahead.
111 replies
RRailway
Created by materwelon on 10/12/2024 in #✋|help
Need help building and deploying monorepo on railway
because it's a monorepo
111 replies
RRailway
Created by materwelon on 10/12/2024 in #✋|help
Need help building and deploying monorepo on railway
it'll need it for the build
111 replies
RRailway
Created by materwelon on 10/12/2024 in #✋|help
Need help building and deploying monorepo on railway
looks like this now
111 replies
RRailway
Created by materwelon on 10/12/2024 in #✋|help
Need help building and deploying monorepo on railway
# Stage 1: Build the Frontend
FROM node:22-alpine AS builder

ARG API_URL
ARG RAILWAY_ENVIRONMENT
ARG RAILWAY_SERVICE_NAME

# Set working directory
WORKDIR /app
# Stage 1: Build the Frontend
FROM node:22-alpine AS builder

ARG API_URL
ARG RAILWAY_ENVIRONMENT
ARG RAILWAY_SERVICE_NAME

# Set working directory
WORKDIR /app
111 replies
RRailway
Created by materwelon on 10/12/2024 in #✋|help
Need help building and deploying monorepo on railway
and I'll only need that when someone interacts with the frontend
111 replies