2023-02-15 01:21:36 +02:00
|
|
|
# syntax=docker/dockerfile:1
|
|
|
|
|
2023-02-15 03:16:04 +02:00
|
|
|
FROM node:18-alpine AS builder
|
2023-02-15 01:22:52 +02:00
|
|
|
WORKDIR /build
|
|
|
|
# install python etc so node-gyp works for the optional dependencies
|
2023-02-15 03:13:35 +02:00
|
|
|
RUN apk add --no-cache make gcc g++ python3
|
2023-02-15 01:22:52 +02:00
|
|
|
# install pnpm to make dependency installation faster (because it has a lockfile)
|
|
|
|
RUN npm install -g pnpm
|
2023-02-15 03:22:09 +02:00
|
|
|
COPY package.json pnpm-lock.yaml ./
|
|
|
|
COPY --link scripts scripts
|
2023-03-12 15:53:35 +02:00
|
|
|
RUN chmod +x ./scripts/start.sh
|
2023-02-15 01:22:52 +02:00
|
|
|
# install dependencies, CI=true to skip pre/postinstall scripts
|
|
|
|
RUN CI=true pnpm install --prod --frozen-lockfile
|
|
|
|
COPY --link . .
|
2023-02-15 01:21:36 +02:00
|
|
|
|
2023-02-15 03:16:04 +02:00
|
|
|
FROM node:18-alpine AS runner
|
2023-06-17 01:31:19 +03:00
|
|
|
RUN apk --no-cache add curl \
|
2024-01-11 02:23:25 +02:00
|
|
|
&& adduser --disabled-password --home /home/container container \
|
2024-01-12 02:42:17 +02:00
|
|
|
&& mkdir /app \
|
|
|
|
&& chmod -R 777 /app
|
2023-06-15 02:21:52 +03:00
|
|
|
USER container
|
|
|
|
ENV USER=container \
|
|
|
|
HOME=/home/container \
|
|
|
|
NODE_ENV=production \
|
2023-02-15 01:21:36 +02:00
|
|
|
HTTP_HOST=0.0.0.0 \
|
2024-01-11 06:57:43 +02:00
|
|
|
HTTP_PORT=80 \
|
|
|
|
DOCKER=true
|
2023-06-15 02:21:52 +03:00
|
|
|
WORKDIR /home/container
|
2024-01-11 02:23:25 +02:00
|
|
|
COPY --from=builder --chown=container:container /build /app
|
2023-06-15 02:21:52 +03:00
|
|
|
EXPOSE ${HTTP_PORT}/tcp
|
2024-01-11 02:23:25 +02:00
|
|
|
ENTRYPOINT [ "/app/scripts/start.sh" ]
|
2023-06-15 02:21:52 +03:00
|
|
|
HEALTHCHECK --interval=15s --timeout=5s --start-period=60s \
|
|
|
|
CMD curl -f http://localhost:${HTTP_PORT}/status || exit 1
|
|
|
|
LABEL org.opencontainers.image.source=https://github.com/discord-tickets/bot \
|
|
|
|
org.opencontainers.image.description="The most popular open-source ticket bot for Discord." \
|
|
|
|
org.opencontainers.image.licenses="GPL-3.0-or-later"
|