-
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.
Merge pull request #9 from seroanalytics/i3
i3 Dockerise the app
- Loading branch information
Showing
18 changed files
with
755 additions
and
51 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,7 @@ | ||
/node_modules | ||
*.log | ||
.DS_Store | ||
.env | ||
/.cache | ||
/public/build | ||
/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,37 @@ | ||
name: 🚢 Docker | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
env: | ||
BRANCH_NAME: ${{ github.head_ref || github.ref_name }} | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
docker: | ||
name: 🚢 Docker | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: ⬇️ Checkout repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: 🔨 Build image | ||
run: ./scripts/build | ||
|
||
- name: 🔥 Smoke test | ||
run: ./scripts/smoke-test | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: 🚢 Push image | ||
run: ./scripts/push |
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,51 @@ | ||
# base node image | ||
|
||
FROM node:21-bullseye-slim AS base | ||
|
||
# set for base and all layer that inherit from it | ||
|
||
ENV NODE_ENV=production | ||
|
||
# Install all node_modules, including dev dependencies | ||
|
||
FROM base AS deps | ||
|
||
WORKDIR /app | ||
|
||
ADD package.json ./ | ||
RUN npm install --include=dev | ||
|
||
# Setup production node_modules | ||
|
||
FROM base AS production-deps | ||
|
||
WORKDIR /app | ||
|
||
COPY --from=deps /app/node_modules /app/node_modules | ||
ADD package.json ./ | ||
RUN npm prune --omit=dev | ||
|
||
# Build the app | ||
|
||
FROM base AS build | ||
|
||
WORKDIR /app | ||
|
||
COPY --from=deps /app/node_modules /app/node_modules | ||
|
||
ADD . . | ||
RUN npm run build | ||
|
||
# Finally, build the production image with minimal footprint | ||
|
||
FROM base | ||
|
||
WORKDIR /app | ||
|
||
COPY --from=production-deps /app/node_modules /app/node_modules | ||
|
||
COPY --from=build /app/build /app/build | ||
COPY --from=build /app/public /app/public | ||
ADD . . | ||
|
||
CMD ["npm", "start"] |
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
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
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
Oops, something went wrong.