initial attempt at IaC and CI/CD

This commit is contained in:
Chris Kruining 2024-11-14 16:22:11 +01:00
parent 597c7e4e0b
commit 820b251c61
No known key found for this signature in database
GPG key ID: EB894A3560CCCAD2
11 changed files with 355 additions and 1 deletions

32
Dockerfile Normal file
View file

@ -0,0 +1,32 @@
FROM oven/bun:1 as base
WORKDIR /usr/src/app
FROM base AS install
RUN mkdir -p /temp/dev
COPY package.json bun.lockb /temp/dev
RUN cd /temp/dev && bun install --frozen-lockfile
RUN mkdir -p /temp/prod
COPY package.json bun.lockb /temp/prod/
RUN cd /temp/prod && bun install --frozen-lockfile --production
FROM base AS prerelease
COPY --from=install /temp/dev/node_modules node_modules
COPY . .
ENV NODE_ENV=production
ENV SERVER_PRESET=bun
RUN bun test
RUN chmod +x node_modules/.bin/*
RUN bun run build
FROM base AS release
COPY --from=install /temp/prod/node_modules node_modules
COPY --from=prerelease /usr/src/app/bun.lockb .
COPY --from=prerelease /usr/src/app/package.json .
COPY --from=prerelease /usr/src/app/.vinxi .vinxi
COPY --from=prerelease /usr/src/app/.output .output
USER bun
EXPOSE 3000/tcp
ENTRYPOINT [ "bun", "run", "start" ]