mirror of
https://github.com/Hessenuk/DiscordTickets.git
synced 2025-09-05 09:41:27 +03:00
chore: clean up dockerfile (#606)
This commit is contained in:
33
Dockerfile
33
Dockerfile
@@ -1,35 +1,46 @@
|
|||||||
# syntax=docker/dockerfile:1
|
# syntax=docker/dockerfile:1
|
||||||
|
|
||||||
FROM node:22-alpine3.20 AS builder
|
FROM node:22-alpine3.20 AS builder
|
||||||
WORKDIR /build
|
|
||||||
# install python etc so node-gyp works for the optional dependencies
|
# install required depencencies for node-gyp
|
||||||
RUN apk add --no-cache make gcc g++ python3
|
RUN apk add --no-cache make gcc g++ python3
|
||||||
# install pnpm to make dependency installation faster (because it has a lockfile)
|
|
||||||
RUN npm install -g pnpm
|
RUN npm install -g pnpm
|
||||||
COPY package.json pnpm-lock.yaml ./
|
|
||||||
|
WORKDIR /build
|
||||||
|
|
||||||
COPY --link scripts scripts
|
COPY --link scripts scripts
|
||||||
RUN chmod +x ./scripts/start.sh
|
RUN chmod +x ./scripts/start.sh
|
||||||
# install dependencies, CI=true to skip pre/postinstall scripts
|
|
||||||
|
COPY package.json pnpm-lock.yaml ./
|
||||||
|
|
||||||
RUN CI=true pnpm install --prod --frozen-lockfile
|
RUN CI=true pnpm install --prod --frozen-lockfile
|
||||||
|
|
||||||
COPY --link . .
|
COPY --link . .
|
||||||
|
|
||||||
FROM node:22-alpine3.20 AS runner
|
FROM node:22-alpine3.20 AS runner
|
||||||
RUN apk --no-cache add curl \
|
LABEL org.opencontainers.image.source=https://github.com/discord-tickets/bot \
|
||||||
&& adduser --disabled-password --home /home/container container \
|
org.opencontainers.image.description="The most popular open-source ticket bot for Discord." \
|
||||||
&& mkdir /app \
|
org.opencontainers.image.licenses="GPL-3.0-or-later"
|
||||||
|
|
||||||
|
RUN apk --no-cache add curl
|
||||||
|
|
||||||
|
RUN adduser --disabled-password --home /home/container container
|
||||||
|
RUN mkdir /app \
|
||||||
&& chown container:container /app \
|
&& chown container:container /app \
|
||||||
&& chmod -R 777 /app
|
&& chmod -R 777 /app
|
||||||
|
|
||||||
USER container
|
USER container
|
||||||
ENV USER=container \
|
ENV USER=container \
|
||||||
HOME=/home/container \
|
HOME=/home/container \
|
||||||
NODE_ENV=production \
|
NODE_ENV=production \
|
||||||
HTTP_HOST=0.0.0.0 \
|
HTTP_HOST=0.0.0.0 \
|
||||||
DOCKER=true
|
DOCKER=true
|
||||||
|
|
||||||
WORKDIR /home/container
|
WORKDIR /home/container
|
||||||
|
|
||||||
COPY --from=builder --chown=container:container --chmod=777 /build /app
|
COPY --from=builder --chown=container:container --chmod=777 /build /app
|
||||||
|
|
||||||
ENTRYPOINT [ "/app/scripts/start.sh" ]
|
ENTRYPOINT [ "/app/scripts/start.sh" ]
|
||||||
HEALTHCHECK --interval=15s --timeout=5s --start-period=60s \
|
HEALTHCHECK --interval=15s --timeout=5s --start-period=60s \
|
||||||
CMD curl -f http://localhost:${HTTP_PORT}/status || exit 1
|
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"
|
|
||||||
|
Reference in New Issue
Block a user