super-productivity/Dockerfile
Kingsley Yung afc6264211 fix: start nginx via its built-in entrypoint script
Our custom `docker-entrypoint.sh` starts nginx by directly calling
`nginx -g "daemon off;"`. However, we need the `docker-entrypoint.sh`
built-in in the nginx docker image to convert `default.conf.template` to
the actual nginx config file. Without going through nginx's
`docker-entrypoint.sh`, the resultant docker image fallback to the
default nginx configuration, which doesn't forward traffic to webdav
backend server.

This patch fixes this by calling the nginx's `docker-entrypoint.sh` at
the end of our custom `docker-entrypoint.sh`.

Fix: The first issue in https://github.com/johannesjo/super-productivity/issues/4545#issuecomment-2974843258
2025-06-17 18:29:02 +02:00

57 lines
1.3 KiB
Docker

# builds the app and runs the webversion inside a docker container
### build ###
# base image
FROM --platform=$BUILDPLATFORM node:20 as build
# add app
COPY . /app
# set working directory
WORKDIR /app
# add `/app/node_modules/.bin` to $PATH
ENV PATH /app/node_modules/.bin:$PATH
RUN npm i
RUN npm i -g @angular/cli
# run linter
RUN npm run lint
# generate build
RUN npm run buildFrontend:prodWeb
### serve ###
# base image
# --platform=$TARGETPLATFORM is redundant and docker will raise a warning,
# but it makes it clearer that the target platform might be different from the
# build platform
FROM --platform=$TARGETPLATFORM nginx:1-alpine
# environmental variables
ENV PORT=80
# install dependencies
RUN apk update \
&& apk add --no-cache jq=1.7.1-r0
# copy artifact build from the 'build environment'
COPY --from=build /app/dist/browser /usr/share/nginx/html
# copy nginx config
COPY ./nginx/default.conf.template /etc/nginx/templates/default.conf.template
# copy our custom entrypoint script
COPY ./docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
# expose port: defaults to 80
EXPOSE $PORT
# set working directory
WORKDIR /usr/share/nginx/html
# use our custom entrypoint script, to provide extra steps
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]