-
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.
add docker entrypoint to try and run backend before frontend build. (…
…#403)
- Loading branch information
Magnus Alexander Strømseng
authored and
GitHub
committed
May 9, 2024
1 parent
34b916c
commit 974e2d4
Showing
3 changed files
with
41 additions
and
28 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 |
|---|---|---|
| @@ -1,8 +1,12 @@ | ||
| FROM node:20 | ||
| WORKDIR /usr/src/app/frontend | ||
| EXPOSE 3000 | ||
|
|
||
| COPY frontend /usr/src/app/frontend | ||
| COPY .env.production /usr/src/app/frontend/.env.production | ||
| RUN npm i | ||
| RUN npm run build | ||
| EXPOSE 3000 | ||
| CMD ["npm", "run", "start"] | ||
|
|
||
| COPY docker-entrypoint.sh / | ||
| RUN chmod +x /docker-entrypoint.sh | ||
|
|
||
| ENTRYPOINT ["/bin/sh", "/docker-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 |
|---|---|---|
| @@ -1,28 +1,30 @@ | ||
| version: "3.3" | ||
| services: | ||
| backend: | ||
| restart: unless-stopped | ||
| volumes: | ||
| - type: bind | ||
| source: /var/data/ | ||
| target: /var/data/ | ||
| - type: bind | ||
| source: /var/data/outreachuploads | ||
| target: /usr/src/app/backend/public/uploads | ||
| build: | ||
| context: . | ||
| dockerfile: Dockerfile-backend | ||
| image: backend:outreach | ||
| ports: | ||
| - "1337:1337" | ||
| environment: | ||
| - NODE_ENV=production | ||
| backend: | ||
| restart: unless-stopped | ||
| volumes: | ||
| - type: bind | ||
| source: /var/data/ | ||
| target: /var/data/ | ||
| - type: bind | ||
| source: /var/data/outreachuploads | ||
| target: /usr/src/app/backend/public/uploads | ||
| build: | ||
| context: . | ||
| dockerfile: Dockerfile-backend | ||
| image: backend:outreach | ||
| ports: | ||
| - "1337:1337" | ||
| environment: | ||
| - NODE_ENV=production | ||
|
|
||
| frontend: | ||
| restart: unless-stopped | ||
| build: | ||
| context: . | ||
| dockerfile: Dockerfile-frontend | ||
| image: frontend:outreach | ||
| ports: | ||
| - "3000:3000" | ||
| frontend: | ||
| depends_on: | ||
| - backend | ||
| restart: unless-stopped | ||
| build: | ||
| context: . | ||
| dockerfile: Dockerfile-frontend | ||
| image: frontend:outreach | ||
| ports: | ||
| - "3000:3000" |
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 @@ | ||
| #!/bin/bash | ||
|
|
||
| # Build the Next site including SSG | ||
| npm run build | ||
|
|
||
| # Start the production server | ||
| exec npm run start |