preciazo/Dockerfile

28 lines
815 B
Text
Raw Normal View History

2024-01-14 13:18:39 +00:00
FROM cgr.dev/chainguard/wolfi-base AS base
2024-01-06 23:23:06 +00:00
WORKDIR /usr/src/app
FROM base as build
2024-01-14 13:18:39 +00:00
RUN apk add --no-cache nodejs npm
RUN npm install --global pnpm
2024-01-06 23:23:06 +00:00
COPY . .
2024-01-14 13:31:23 +00:00
COPY db-datos/drizzle .
2024-01-06 23:23:06 +00:00
RUN cd sitio && \
pnpm install && \
2024-01-14 13:18:39 +00:00
pnpm build
2024-01-06 23:23:06 +00:00
2024-01-14 13:18:39 +00:00
FROM base
ENV NODE_ENV=production
2024-01-14 13:18:39 +00:00
RUN apk add --no-cache nodejs npm jq sqlite
2024-01-06 23:23:06 +00:00
# Sitio
COPY --from=build /usr/src/app/sitio/package.json package.real.json
RUN sh -c 'echo {\"name\":\"sitio\",\"type\":\"module\",\"dependencies\":$(jq .dependencies < package.real.json)} > package.json' && npm install
COPY --from=build /usr/src/app/db-datos node_modules/db-datos
COPY --from=build /usr/src/app/sitio/build .
2024-01-24 20:57:59 +00:00
COPY --from=build /usr/src/app/sitio/src/migrate.js .
2024-01-14 13:18:39 +00:00
COPY --from=build /usr/src/app/db-datos/drizzle .
2024-01-06 23:23:06 +00:00
ENV DB_PATH=/db/db.db
EXPOSE 3000
2024-01-24 20:57:59 +00:00
CMD "node migrate.js && node ."