2024-05-08 16:39:54 -10:00
|
|
|
# Use 1.1.4 for building to prevent a Unicode bug with 1.1.5+
|
|
|
|
|
# Temporary until they fix it
|
|
|
|
|
FROM imbios/bun-node:1.1.4-current-alpine as base
|
2024-04-06 20:13:09 -10:00
|
|
|
|
2024-04-14 02:18:17 -10:00
|
|
|
RUN apk add --no-cache libstdc++
|
|
|
|
|
|
2024-04-06 20:13:09 -10:00
|
|
|
# Install dependencies into temp directory
|
|
|
|
|
# This will cache them and speed up future builds
|
|
|
|
|
FROM base AS install
|
|
|
|
|
|
|
|
|
|
RUN mkdir -p /temp
|
2024-04-09 01:22:11 -10:00
|
|
|
COPY . /temp
|
2024-04-06 20:13:09 -10:00
|
|
|
WORKDIR /temp
|
2024-05-06 17:57:35 +00:00
|
|
|
RUN bun install --frozen-lockfile --production
|
2024-04-06 20:13:09 -10:00
|
|
|
|
|
|
|
|
FROM base as build
|
2023-11-19 16:05:07 -10:00
|
|
|
|
2024-04-06 20:13:09 -10:00
|
|
|
# Copy the project
|
2023-12-08 15:00:02 -10:00
|
|
|
RUN mkdir -p /temp
|
|
|
|
|
COPY . /temp
|
2024-04-06 20:13:09 -10:00
|
|
|
# Copy dependencies
|
|
|
|
|
COPY --from=install /temp/node_modules /temp/node_modules
|
2023-12-08 13:00:47 -10:00
|
|
|
# Build the project
|
2024-04-06 20:13:09 -10:00
|
|
|
WORKDIR /temp
|
2024-05-07 23:42:38 +00:00
|
|
|
RUN bun run build
|
2024-04-07 03:14:51 -10:00
|
|
|
WORKDIR /temp/dist
|
2023-12-08 13:00:47 -10:00
|
|
|
|
2024-04-13 18:15:15 -10:00
|
|
|
# Copy production dependencies and source code into final image
|
2024-05-11 15:34:57 -10:00
|
|
|
FROM oven/bun:1.1.8-alpine
|
2023-11-19 16:05:07 -10:00
|
|
|
|
2024-04-14 02:19:04 -10:00
|
|
|
RUN apk add --no-cache libstdc++
|
|
|
|
|
|
2023-11-19 16:05:07 -10:00
|
|
|
# Create app directory
|
|
|
|
|
RUN mkdir -p /app
|
2024-04-06 20:13:09 -10:00
|
|
|
COPY --from=build /temp/dist /app/dist
|
2023-12-08 13:00:47 -10:00
|
|
|
COPY entrypoint.sh /app
|
2023-11-19 16:05:07 -10:00
|
|
|
|
2023-11-26 19:30:57 -10:00
|
|
|
LABEL org.opencontainers.image.authors "Gaspard Wierzbinski (https://cpluspatch.dev)"
|
|
|
|
|
LABEL org.opencontainers.image.source "https://github.com/lysand-org/lysand"
|
|
|
|
|
LABEL org.opencontainers.image.vendor "Lysand Org"
|
2024-05-05 11:35:27 -10:00
|
|
|
LABEL org.opencontainers.image.licenses "AGPL-3.0-or-later"
|
2023-11-26 19:30:57 -10:00
|
|
|
LABEL org.opencontainers.image.title "Lysand Server"
|
|
|
|
|
LABEL org.opencontainers.image.description "Lysand Server docker image"
|
2023-11-19 16:05:07 -10:00
|
|
|
|
2023-11-27 12:08:18 -10:00
|
|
|
# CD to app
|
|
|
|
|
WORKDIR /app
|
2023-11-27 15:47:39 -10:00
|
|
|
ENV NODE_ENV=production
|
2024-04-13 18:14:09 -10:00
|
|
|
ENTRYPOINT [ "/bin/sh", "/app/entrypoint.sh" ]
|
2023-11-27 15:47:39 -10:00
|
|
|
# Run migrations and start the server
|
2024-05-13 11:54:51 -10:00
|
|
|
CMD [ "cli", "start" ]
|