wasp/waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/.wasp/out/Dockerfile

54 lines
2.0 KiB
Docker
Raw Normal View History

# NOTE: Why do we specify alpine version here?
# Because if not, we had situations where it would use the different version
# locally and on Github CI. This way we ensure exact version is used,
# and also have control over updating it (instead of update surprising us).
FROM node:18-alpine3.17 AS node
2022-12-15 01:41:10 +03:00
# We split Dockerfile into base, server-builder and server-production.
# This way we have separate situations -> in server-builder we build all
# we need to run the server, and then in server-production we start fresh
# and just copy what we need from server-builder, avoiding intermediate
# artifacts and any settings / pollution we don't need in production
# but only for building.
2022-12-15 01:41:10 +03:00
FROM node AS base
RUN apk --no-cache -U upgrade # To ensure any potential security patches are applied.
# TODO: Remove line below (installation of openssl 1.1) once Prisma adds support for
# openssl 3 on alpine. Alpine >= 3.17 has openssl 3 as default.
# Relevant GH issue: https://github.com/wasp-lang/wasp/issues/877
RUN apk add --no-cache openssl1.1-compat
2022-12-15 01:41:10 +03:00
FROM base AS server-builder
RUN apk add --no-cache build-base libtool autoconf automake
WORKDIR /app
COPY server/ ./server/
# Install npm packages, resulting in node_modules/.
RUN cd server && npm install
COPY db/schema.prisma ./db/
Bring Prisma entities to the frontend (#962) * Support typing backend queries * Implement types for actions and extract entities * Add Prisma entities to the frontend * Add frontend types to internal todoApp * Undo moving for easier review * Revert back to generating a query.js file * Rename buildEntityData * Remove solved todo in schema template * Fix docs in method * Adding uninstall command (#953) * Adding uninstall command * Updates docs and changelog related to the uninstall command * Use StrongPath instead of FilePath * Fix review feedback * Move prisma client generation messages * Generalize FileDraft functions * Generate prisma clients using ENV * Fix schema checksum check * Small refactor in db generator * Run prisma generate from server root dir * Fix types for useAction * Fix type error for useAction * Fix schema generation in Dockerfile * Refactor passing env vars to prisma schema * Fix useAction types * Replace Prelude readFile with SP readFile * Add comment for prisma/client in web app * Replace Prelude writeFile with SP writeFile * Replace do and if with ifM * Rename readProjectTelemetryFile * Refactor readOrCreateUserSignatureFile * Remove redundant comment * Fix typo in variable name * Simulate unions with a type class * Further improve strongpath types * Generate prisma clients after migration * Change ModuleRootDir to ComponentRootDir * Remove solved todo * Improve naming * Remove redundant env variable * Improve formatting * Fix errors after merging * Change local function name Co-authored-by: Martin Šošić <Martinsos@users.noreply.github.com> * Rename local function again * Update changelog * Fix error type in useQuery * Rename Component to AppComponent * Refactor DbGenerator * Explain Abs paths in SP helpers * Update e2e tests * Fix formatting * Change signature for doesFileExist * Change signature for SP functions * Remove redundant do block * Fix formatting * Reorder functions * Rename module to appComponent in functions * Rename module to component in functions * Rename telemetry cache function * Fix formatting --------- Co-authored-by: Mihovil Ilakovac <mihovil@ilakovac.com> Co-authored-by: Martin Šošić <Martinsos@users.noreply.github.com>
2023-02-13 16:31:49 +03:00
RUN cd server && PRISMA_CLIENT_OUTPUT_DIR=../server/node_modules/.prisma/client/ npx prisma generate --schema='../db/schema.prisma'
# Building the server should come after Prisma generation.
RUN cd server && npm run build
# TODO: Use pm2?
# TODO: Use non-root user (node).
FROM base AS server-production
2022-12-15 01:41:10 +03:00
# In case they want to use python3 in their app.
RUN apk add --no-cache python3
ENV NODE_ENV production
WORKDIR /app
COPY --from=server-builder /app/server/node_modules ./server/node_modules
COPY --from=server-builder /app/server/dist ./server/dist
COPY --from=server-builder /app/server/package*.json ./server/
COPY db/ ./db/
EXPOSE ${PORT}
WORKDIR /app/server
ENTRYPOINT ["npm", "run", "start-production"]
# Any user-defined Dockerfile contents will be appended below.