-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Mihovil Ilakovac <mihovil@ilakovac.com>
- Loading branch information
Showing
3 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# 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 AS node | ||
|
||
|
||
# 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. | ||
|
||
|
||
FROM node AS base | ||
RUN apt update && apt upgrade -y # 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 apt install openssl1.1-compat | ||
|
||
|
||
# Any user-defined Dockerfile contents will be appended below. | ||
FROM base AS server-builder | ||
WORKDIR /app | ||
COPY server/ ./server/ | ||
# Install npm packages, resulting in node_modules/. | ||
RUN cd server && npm install | ||
COPY db/schema.prisma ./db/ | ||
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 | ||
|
||
FROM base AS server-production | ||
RUN curl -sSL https://get.wasp-lang.dev/installer.sh | sh -s -- -v 0.11.1-wasp-ai | ||
ENV PATH "$PATH:/root/.local/bin" | ||
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 --from=server-builder /app/server/scripts ./server/scripts | ||
COPY db/ ./db/ | ||
EXPOSE ${PORT} | ||
WORKDIR /app/server | ||
# RUN cat /root/.local/bin/wasp | ||
# RUN wasp version | ||
ENTRYPOINT ["npm", "run", "start-production"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# fly.toml app configuration file generated for wasp-ai-client on 2023-06-27T10:39:16+02:00 | ||
# | ||
# See https://fly.io/docs/reference/configuration/ for information about how to use this file. | ||
# | ||
|
||
app = "wasp-ai-client" | ||
primary_region = "mad" | ||
|
||
[http_service] | ||
internal_port = 8043 | ||
force_https = true | ||
auto_stop_machines = true | ||
auto_start_machines = true | ||
min_machines_running = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# fly.toml app configuration file generated for wasp-ai-server on 2023-06-27T10:39:08+02:00 | ||
# | ||
# See https://fly.io/docs/reference/configuration/ for information about how to use this file. | ||
# | ||
|
||
app = "wasp-ai-server" | ||
primary_region = "mad" | ||
|
||
[http_service] | ||
internal_port = 8080 | ||
force_https = true | ||
auto_stop_machines = true | ||
auto_start_machines = true | ||
min_machines_running = 0 |