forked from Shelf-nu/shelf.nu
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move container image in own Dockerfile
Signed-off-by: Anatoli Nicolae <[email protected]> Fix workflow property Signed-off-by: Anatoli Nicolae <[email protected]>
- Loading branch information
1 parent
b8bb636
commit ed7b51e
Showing
3 changed files
with
58 additions
and
3 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 |
---|---|---|
|
@@ -62,6 +62,7 @@ jobs: | |
uses: docker/[email protected] | ||
with: | ||
context: . | ||
file: Dockerfile.image | ||
platforms: linux/amd64,linux/arm64 | ||
push: true | ||
# Note: provenance fixes unknown/unknown platform to be generated on build | ||
|
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
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,53 @@ | ||
# base node image | ||
FROM node:20-bookworm-slim as base | ||
|
||
# set for base and all layer that inherit from it | ||
ENV NODE_ENV="production" | ||
|
||
WORKDIR /myapp | ||
|
||
# Install openssl for Prisma | ||
RUN apt-get update && apt-get install -y openssl | ||
|
||
# Install all node_modules, including dev dependencies | ||
FROM base as deps | ||
|
||
ADD package.json ./ | ||
RUN npm install --production=false | ||
|
||
# Setup production node_modules | ||
FROM base as production-deps | ||
|
||
COPY --from=deps /myapp/node_modules /myapp/node_modules | ||
ADD package.json ./ | ||
RUN npm prune --production | ||
|
||
# Build the app | ||
FROM base as build | ||
|
||
COPY --from=deps /myapp/node_modules /myapp/node_modules | ||
|
||
ADD /app/database ./app/database | ||
RUN npx prisma generate | ||
|
||
ADD . . | ||
RUN npm run build | ||
|
||
# Finally, build the production image with minimal footprint | ||
FROM base | ||
|
||
ENV PORT="8080" | ||
ENV NODE_ENV="production" | ||
|
||
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/node_modules/prisma /myapp/node_modules/prisma | ||
COPY --from=build /myapp/app/database /myapp/app/database | ||
|
||
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/docker-entrypoint.sh /myapp/docker-entrypoint.sh | ||
RUN chmod +x /myapp/docker-entrypoint.sh | ||
|
||
ENTRYPOINT [ "/myapp/docker-entrypoint.sh" ] |