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-15 02:21:52 +03:00
|
|
|
RUN adduser --disabled-password --home /home/container container
|
|
|
|
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 \
|
2023-03-11 17:03:11 +02:00
|
|
|
HTTP_PORT=80
|
2023-06-15 02:21:52 +03:00
|
|
|
WORKDIR /home/container
|
2023-06-17 00:52:04 +03:00
|
|
|
COPY --from=builder --chown=container:container /build ./
|
2023-06-15 02:21:52 +03:00
|
|
|
EXPOSE ${HTTP_PORT}/tcp
|
|
|
|
ENTRYPOINT [ "/home/container/scripts/start.sh" ]
|
|
|
|
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"
|