Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repo sync #35880

Merged
merged 3 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,10 @@ To ensure that all the line endings in your repository match your new configurat
git commit -m "Saving files before refreshing line endings"
```

1. To update all files on the current branch to reflect the new configuration, run the following commands.
1. To update all files on the current branch to reflect the new configuration, run the following command.

```shell copy
git rm -rf --cached .
git reset --hard HEAD
git add --renormalize .
```

1. To display the rewritten, normalized files, run the following command.
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.

Loading