Skip to content

Commit

Permalink
Merge pull request #35880 from github/repo-sync
Browse files Browse the repository at this point in the history
Repo sync
  • Loading branch information
docs-bot authored Jan 9, 2025
2 parents 1dae813 + 43e1234 commit e4fecf9
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 81 deletions.
34 changes: 21 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,30 @@
# --------------------------------------------------------------------------------
# BASE IMAGE
# --------------------------------------------------------------------------------
# To update the sha, run `docker pull node:$VERSION-alpine`
# look for something like: `Digest: sha256:0123456789abcdef`
FROM node:22-alpine@sha256:c13b26e7e602ef2f1074aef304ce6e9b7dd284c419b35d89fcf3cc8e44a8def9 AS base
# To update the sha:
# https://github.com/github/gh-base-image/pkgs/container/gh-base-image%2Fgh-base-noble
FROM ghcr.io/github/gh-base-image/gh-base-noble:20250108-185521-gcd4825276 AS base

# Install git for cloning docs-early-access & translations repos
# Install curl for determining the early access branch
RUN apt-get -qq update && apt-get -qq install --no-install-recommends git curl

# Install Node.js latest LTS
# https://github.com/nodejs/release#release-schedule
# Ubuntu's apt-get install nodejs is _very_ outdated
RUN curl -sL https://deb.nodesource.com/setup_22.x | bash -
RUN apt-get install -y nodejs
RUN node --version

# This directory is owned by the node user
RUN useradd -ms /bin/bash node
ARG APP_HOME=/home/node/app
RUN mkdir -p $APP_HOME && chown -R node:node $APP_HOME
WORKDIR $APP_HOME

# Switch to root to ensure we have permissions to copy, chmod, and install
USER root

# Install git for cloning docs-early-access & translations repos
# Install curl for determining the early access branch
RUN apk add --no-cache git curl

# Copy in build scripts
COPY src/deployments/production/build-scripts/*.sh ./build-scripts/

Expand All @@ -39,12 +47,12 @@ COPY data ./data
# We use --mount-type=secret to avoid the secret being copied into the image layers for security
# The secret passed via --secret can only be used in this RUN command
RUN --mount=type=secret,id=DOCS_BOT_PAT_READPUBLICKEY \
# We don't cache because Docker can't know if we need to fetch new content from remote repos
echo "Don't cache this step by printing date: $(date)" && \
. ./build-scripts/fetch-repos.sh
# We don't cache because Docker can't know if we need to fetch new content from remote repos
echo "Don't cache this step by printing date: $(date)" && \
. ./build-scripts/fetch-repos.sh

# Give node user access to the copied content since we cloned as root
RUN chown -R node:node $APP_HOME/content
RUN chown -R node:node $APP_HOME/content
RUN chown -R node:node $APP_HOME/assets
RUN chown -R node:node $APP_HOME/data
# Give node user access to translations repos
Expand Down Expand Up @@ -105,7 +113,7 @@ RUN npm run precompute-pageinfo -- --max-versions 2
RUN npm prune --production

# --------------------------------------------------------------------------------
# PRODUCTION IMAGE
# PRODUCTION IMAGE
# --------------------------------------------------------------------------------
FROM base AS production

Expand Down Expand Up @@ -140,7 +148,7 @@ COPY --chown=node:node --from=builder $APP_HOME/next.config.js ./
COPY --chown=node:node --from=builder $APP_HOME/tsconfig.json ./

# - - -
# Environment variables are set in the Moda
# Environment variables are set in the Moda
# configuration: config/moda/configuration/*/env.yaml
# - - -

Expand Down
2 changes: 0 additions & 2 deletions src/frame/middleware/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import archivedEnterpriseVersionsAssets from '@/archives/middleware/archived-ent
import api from './api'
import healthz from './healthz'
import manifestJson from './manifest-json'
import remoteIP from './remote-ip'
import buildInfo from './build-info'
import reqHeaders from './req-headers'
import archivedEnterpriseVersions from '@/archives/middleware/archived-enterprise-versions'
Expand Down Expand Up @@ -245,7 +244,6 @@ export default function (app: Express) {

// *** Rendering, 2xx responses ***
app.use('/api', api)
app.get('/_ip', remoteIP)
app.get('/_build', buildInfo)
app.get('/_req-headers', reqHeaders)
app.use(asyncMiddleware(manifestJson))
Expand Down
25 changes: 0 additions & 25 deletions src/frame/middleware/remote-ip.ts

This file was deleted.

41 changes: 0 additions & 41 deletions src/frame/tests/remote-ip.ts

This file was deleted.

0 comments on commit e4fecf9

Please sign in to comment.