2024-09-10 19:40:08 +03:00
|
|
|
FROM node:20.9-alpine
|
2018-05-29 19:01:36 +03:00
|
|
|
|
|
|
|
RUN addgroup -g 10001 app && \
|
|
|
|
adduser -D -G app -h /app -u 10001 app
|
2019-12-14 01:37:53 +03:00
|
|
|
RUN rm -rf /tmp/*
|
2018-05-29 19:01:36 +03:00
|
|
|
|
2023-09-15 04:41:36 +03:00
|
|
|
# Install Python
|
|
|
|
ENV PYTHONUNBUFFERED=1
|
2024-01-29 20:42:34 +03:00
|
|
|
RUN apk add --update --no-cache python3 py3-pip && ln -sf python3 /usr/bin/python
|
2023-09-15 04:41:36 +03:00
|
|
|
|
2018-05-29 19:01:36 +03:00
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
USER app
|
|
|
|
|
|
|
|
COPY package.json package.json
|
|
|
|
COPY package-lock.json package-lock.json
|
|
|
|
|
2019-12-03 00:55:54 +03:00
|
|
|
COPY --chown=app:app . /app
|
2018-09-21 17:54:27 +03:00
|
|
|
|
2023-01-23 23:29:49 +03:00
|
|
|
RUN npm ci --audit=false && rm -rf ~app/.npm /tmp/*
|
|
|
|
|
Adopt .env.local file
This makes it clearer what variables actually need to be set
locally, and which have been forgotten. It also makes the build
simpler, by removing the need to copy the .env-dist file.
This should be safe to apply, since .env-dist already got loaded by
default, just like .env now is. And it is still the case that
actual environment variables overwrite the ones in the .env file.
For non-Next.js setups (e.g. cron jobs or database migrations), I
switched to dotenv-flow. The regular dotenv explicitly avoids
inheritance [1], because it wants environment variables to be
specific to an environment. That was already not the case with most
of our environment variables, so the switch makes sense for us.
Next steps could be to remove unused variables from .env, and
possibly moving variables with local/stage-specific values to
.env.local.example, though that riskier, since environments might
depend on those being present.
[1]
https://www.npmjs.com/package/dotenv#should-i-have-multiple-env-files
2024-07-02 17:01:52 +03:00
|
|
|
COPY .env ./.env
|
2024-01-29 20:42:34 +03:00
|
|
|
|
|
|
|
ARG NEXT_PUBLIC_GA4_DEBUG_MODE
|
|
|
|
ENV NEXT_PUBLIC_GA4_DEBUG_MODE=false
|
|
|
|
|
2023-08-01 01:36:21 +03:00
|
|
|
ARG S3_BUCKET
|
|
|
|
ENV S3_BUCKET=$S3_BUCKET
|
2024-01-29 20:42:34 +03:00
|
|
|
|
2023-09-15 04:41:36 +03:00
|
|
|
RUN GLEAN_PYTHON=python GLEAN_PIP=pip npm run build
|
2022-06-02 06:53:19 +03:00
|
|
|
|
2022-08-17 18:24:39 +03:00
|
|
|
ARG SENTRY_RELEASE
|
|
|
|
ENV SENTRY_RELEASE=$SENTRY_RELEASE
|
|
|
|
|
2024-05-16 07:14:24 +03:00
|
|
|
CMD ["npm", "start"]
|