Skip to content

Commit

Permalink
Decouple Docker entrypoint and fix schema issues
Browse files Browse the repository at this point in the history
Signed-off-by: Anatoli Nicolae <[email protected]>
  • Loading branch information
anatolinicolae committed Mar 20, 2024
1 parent bf36023 commit 9087484
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
9 changes: 5 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ WORKDIR /myapp

COPY --from=deps /myapp/node_modules /myapp/node_modules

ADD /app/database/schema.prisma .
ADD /app/database/schema.prisma ./app/database/schema.prisma
RUN npx prisma generate

ADD . .
Expand All @@ -47,11 +47,12 @@ WORKDIR /myapp

COPY --from=production-deps /myapp/node_modules /myapp/node_modules
COPY --from=build /myapp/node_modules/.prisma /myapp/node_modules/.prisma
COPY --from=build /myapp/app/database/schema.prisma /myapp/app/database/schema.prisma

COPY --from=build /myapp/build /myapp/build
COPY --from=build /myapp/public /myapp/public
COPY --from=build /myapp/package.json /myapp/package.json
COPY --from=build /myapp/start.sh /myapp/start.sh
RUN chmod +x /myapp/start.sh
COPY --from=build /myapp/docker-entrypoint.sh /myapp/docker-entrypoint.sh
RUN chmod +x /myapp/docker-entrypoint.sh

ENTRYPOINT [ "./start.sh" ]
ENTRYPOINT [ "./docker-entrypoint.sh" ]
12 changes: 12 additions & 0 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh -ex

# This file is how Fly starts the server (configured in fly.toml). Before starting
# the server though, we need to run any prisma migrations that haven't yet been
# run, which is why this file exists in the first place.
# Learn more: https://community.fly.io/t/sqlite-not-getting-setup-properly/4386

# Generate schema and deploy
npm run setup:db

# Start the app
npm run start

0 comments on commit 9087484

Please sign in to comment.