-
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.
- Loading branch information
1 parent
5005a70
commit 32f672a
Showing
6 changed files
with
136 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,4 @@ | ||
/.yarn/** linguist-vendored | ||
/.yarn/releases/* binary | ||
/.yarn/plugins/**/* binary | ||
/.pnp.* binary linguist-generated |
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 @@ | ||
20.11 |
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,7 @@ | ||
compressionLevel: mixed | ||
|
||
enableGlobalCache: false | ||
|
||
nodeLinker: node-modules | ||
|
||
yarnPath: .yarn/releases/yarn-4.1.0.cjs |
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,42 @@ | ||
FROM node:20.11-bookworm-slim | ||
# Install dependencies | ||
RUN apt-get update -y && \ | ||
apt-get upgrade -y && \ | ||
apt-get install -y \ | ||
build-essential \ | ||
gcc autoconf \ | ||
automake \ | ||
zlib1g-dev \ | ||
libpng-dev \ | ||
nasm bash \ | ||
libvips-dev \ | ||
&& apt-get clean | ||
|
||
ENV NODE_ENV development | ||
|
||
WORKDIR /app | ||
|
||
COPY .yarn ./.yarn | ||
COPY config ./config | ||
COPY database ./database | ||
COPY public ./public | ||
COPY src ./src | ||
|
||
COPY .nvmrc \ | ||
.yarnrc.yml \ | ||
favicon.png \ | ||
package.json \ | ||
entrypoint.sh \ | ||
tsconfig.json \ | ||
yarn.lock \ | ||
./ | ||
|
||
RUN yarn install | ||
|
||
ENV PATH /app/node_modules/.bin:$PATH | ||
|
||
|
||
RUN chown -R node:node /app | ||
USER node | ||
EXPOSE 1337 | ||
ENTRYPOINT ["/app/entrypoint.sh"] |
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,59 @@ | ||
FROM node:20.11-bookworm-slim as build | ||
RUN apt-get update -y && \ | ||
apt-get upgrade -y && \ | ||
apt-get install -y \ | ||
build-essential \ | ||
gcc autoconf \ | ||
automake \ | ||
zlib1g-dev \ | ||
libpng-dev \ | ||
nasm bash \ | ||
libvips-dev \ | ||
&& apt-get clean | ||
|
||
ENV NODE_ENV production | ||
|
||
WORKDIR /app | ||
|
||
COPY .yarn ./.yarn | ||
COPY config ./config | ||
COPY database ./database | ||
COPY public ./public | ||
COPY src ./src | ||
|
||
COPY .env \ | ||
.nvmrc \ | ||
.yarnrc.yml \ | ||
favicon.png \ | ||
package.json \ | ||
entrypoint.sh \ | ||
tsconfig.json \ | ||
yarn.lock \ | ||
./ | ||
|
||
RUN yarn install | ||
|
||
RUN yarn strapi ts:generate-types | ||
|
||
RUN yarn build | ||
|
||
# Copy only the built files into the final image | ||
FROM node:20.11-bookworm-slim AS runner | ||
RUN apt-get update -y && \ | ||
apt-get upgrade -y && \ | ||
apt-get install -y libvips-dev && \ | ||
apt-get clean | ||
|
||
ENV NODE_ENV production | ||
|
||
WORKDIR /app | ||
|
||
RUN addgroup --system --gid 1001 nodejs | ||
RUN adduser --system --uid 1001 strapi | ||
|
||
COPY --from=build --chown=strapi:nodejs /app ./ | ||
|
||
USER strapi | ||
|
||
EXPOSE 1337 | ||
ENTRYPOINT ["/app/entrypoint.sh"] |
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,23 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
case "${NODE_ENV}" in | ||
development) | ||
echo "Import config" | ||
yarn config-sync import -y | ||
echo "Running Development Server" | ||
exec yarn dev | ||
;; | ||
test) | ||
echo "Running Test" | ||
exec yarn test | ||
;; | ||
production) | ||
echo "Import config" | ||
yarn config-sync import -y | ||
echo "Running Production Server" | ||
exec yarn start | ||
;; | ||
*) | ||
echo "Unknown NODE environment: \"${NODE_ENV}\"" | ||
esac |