diff --git a/.github/workflows/build-docker-image.yml b/.github/workflows/build-docker-image.yml new file mode 100644 index 0000000000..7d0a44c3e7 --- /dev/null +++ b/.github/workflows/build-docker-image.yml @@ -0,0 +1,23 @@ +# Make sure the Docker container still builds + +name: Build Docker image + +on: + push: + branches: + - main + pull_request: + branches-ignore: + - translations + +env: + CI: true + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Check out repo + uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f + - name: Build the container + run: docker build . diff --git a/Dockerfile b/Dockerfile index 59846b78f6..6e5205f763 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,18 +7,21 @@ # A temporary image that installs production-only dependencies FROM node:14-alpine as installation +RUN apk add --no-cache python make g++ ENV NODE_ENV production WORKDIR /usr/src/docs COPY package*.json ./ # Install the project's dependencies -RUN npm ci +RUN npm ci --production # -------------------------------------------------------------------------------- # BUNDLE IMAGE # A temporary image that installs dependencies and builds the production-ready front-end bundles. FROM node:14-alpine as bundles +RUN apk add --no-cache python make g++ +ENV NODE_ENV production WORKDIR /usr/src/docs # Install the files used to create the bundles COPY package*.json ./ @@ -27,7 +30,8 @@ COPY stylesheets ./stylesheets COPY lib ./lib COPY webpack.config.js ./webpack.config.js # Install the project's dependencies and build the bundles -RUN npm ci && npm run build +RUN npm ci --production +RUN npm run build # -------------------------------------------------------------------------------- # MAIN IMAGE @@ -52,16 +56,23 @@ COPY --chown=node:node --from=bundles /usr/src/docs/dist /usr/src/docs/dist # We should always be running in production mode ENV NODE_ENV production +# Use Lunr instead of Algolia +ENV USE_LUNR true + # Copy only what's needed to run the server COPY --chown=node:node assets ./assets COPY --chown=node:node content ./content COPY --chown=node:node data ./data COPY --chown=node:node includes ./includes +COPY --chown=node:node layouts ./layouts COPY --chown=node:node lib ./lib COPY --chown=node:node middleware ./middleware COPY --chown=node:node translations ./translations COPY --chown=node:node server.js ./server.js COPY --chown=node:node package*.json ./ +COPY --chown=node:node feature-flags.json ./ +EXPOSE 80 EXPOSE 443 +EXPOSE 4000 CMD ["node", "server.js"]