mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2025-12-19 10:07:46 -05:00
chore(docker): remove api-server Dockerfile (#58591)
This commit is contained in:
committed by
GitHub
parent
46c8afd21b
commit
a6876e8e40
18
.github/workflows/temporary-container-checks.yml
vendored
18
.github/workflows/temporary-container-checks.yml
vendored
@@ -55,24 +55,6 @@ jobs:
|
||||
--build-arg FREECODECAMP_NODE_ENV=development \
|
||||
-f docker/web/Dockerfile .
|
||||
|
||||
build-api:
|
||||
name: Build Api (Container)
|
||||
runs-on: ubuntu-22.04
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [20.x]
|
||||
|
||||
steps:
|
||||
- name: Checkout Source Files
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
with:
|
||||
submodules: 'recursive'
|
||||
|
||||
- name: Create Image
|
||||
run: |
|
||||
docker build \
|
||||
-f docker/api-server/Dockerfile .
|
||||
|
||||
build-new-api:
|
||||
name: Build New Api (Container)
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
FROM node:20-bookworm AS builder
|
||||
# global installs need root permissions, so have to happen before we switch to
|
||||
# the node user
|
||||
RUN npm i -g pnpm@9
|
||||
# node images create a non-root user that we can use
|
||||
USER node
|
||||
WORKDIR /home/node/build
|
||||
|
||||
COPY --chown=node:node *.* .
|
||||
COPY --chown=node:node api-server/ api-server/
|
||||
COPY --chown=node:node shared/ shared/
|
||||
COPY --chown=node:node tools/ tools/
|
||||
COPY --chown=node:node curriculum/ curriculum/
|
||||
# TODO: AFAIK it's just the intro translations. Those should be folded into the
|
||||
# curriculum and then we can remove this.
|
||||
COPY --chown=node:node client/ client/
|
||||
|
||||
# We have to prevent pnpm from deduping peer dependencies because otherwise it
|
||||
# will install all of the packages, not just api-server. Also, pnpm deploy is
|
||||
# not useful since we need to install more than one package.
|
||||
|
||||
RUN pnpm config set dedupe-peer-dependents false
|
||||
RUN pnpm -F=api-server -F=tools/scripts/build -F=challenge-parser -F=curriculum -F=shared \
|
||||
install --frozen-lockfile --ignore-scripts
|
||||
|
||||
# The api needs to source curriculum.json and build:curriculum relies on the
|
||||
# following env vars.
|
||||
ARG SHOW_UPCOMING_CHANGES=false
|
||||
ENV SHOW_UPCOMING_CHANGES=$SHOW_UPCOMING_CHANGES
|
||||
RUN pnpm build:curriculum
|
||||
|
||||
RUN pnpm build:server
|
||||
|
||||
FROM node:20-bookworm AS deps
|
||||
|
||||
WORKDIR /home/node/build
|
||||
COPY --chown=node:node pnpm*.yaml .
|
||||
COPY --chown=node:node api-server/package.json api-server/package.json
|
||||
COPY --chown=node:node shared/package.json shared/package.json
|
||||
|
||||
RUN npm i -g pnpm@9
|
||||
# Prevent pnpm installing unnecessary packages (see above)
|
||||
RUN pnpm config set dedupe-peer-dependents false
|
||||
RUN pnpm -F=api-server -F=shared install --prod --ignore-scripts
|
||||
|
||||
FROM node:20-alpine
|
||||
RUN npm i -g pm2@4
|
||||
USER node
|
||||
WORKDIR /home/node/fcc
|
||||
COPY --from=builder --chown=node:node /home/node/build/api-server/config/ api-server/config/
|
||||
COPY --from=builder --chown=node:node /home/node/build/api-server/lib/ api-server/lib/
|
||||
COPY --from=builder --chown=node:node /home/node/build/api-server/ecosystem.config.js api-server/ecosystem.config.js
|
||||
COPY --from=builder --chown=node:node /home/node/build/api-server/package.json api-server/package.json
|
||||
COPY --from=builder --chown=node:node /home/node/build/shared/ shared/
|
||||
COPY --from=builder --chown=node:node /home/node/build/package.json package.json
|
||||
COPY --from=deps --chown=node:node /home/node/build/node_modules/ node_modules/
|
||||
COPY --from=deps --chown=node:node /home/node/build/api-server/node_modules/ api-server/node_modules/
|
||||
COPY --from=deps --chown=node:node /home/node/build/shared/node_modules/ shared/node_modules/
|
||||
|
||||
CMD ["pm2-runtime", "start", "api-server/ecosystem.config.js"]
|
||||
|
||||
Reference in New Issue
Block a user