forked from darkwire/darkwire.io
-
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
Showing
5 changed files
with
107 additions
and
44 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,33 +1,42 @@ | ||
# Stage 1: Build Stage | ||
FROM node:alpine3.19 AS builder | ||
FROM node:current-alpine AS builder | ||
|
||
WORKDIR /home/node | ||
COPY --chown=node:node . . | ||
WORKDIR /opt/app | ||
COPY . . | ||
|
||
RUN apk update \ | ||
&& apk add --no-cache bash \ | ||
&& chmod +x /home/node/start.sh \ | ||
&& chmod +x /opt/app/start.sh \ | ||
&& npm install -g yarn@latest --force \ | ||
&& yarn install --flat --production --no-cache \ | ||
&& yarn build --no-cache \ | ||
&& rm -rf /home/node/node_modules \ | ||
&& rm -rf /opt/app/node_modules \ | ||
&& rm -rf /opt/app/server/node_modules \ | ||
&& yarn cache clean \ | ||
&& yarn autoclean --force | ||
|
||
# Stage 2: Production Stage | ||
FROM node:alpine3.19 | ||
FROM alpine:latest | ||
|
||
WORKDIR /home/node | ||
COPY --from=builder /home/node . | ||
WORKDIR /opt/app | ||
|
||
COPY --from=builder /opt/app/client/dist /opt/app/client/dist | ||
COPY --from=builder /opt/app/server /opt/app/server | ||
COPY package.json /opt/app/package.json | ||
COPY default.conf /etc/nginx/http.d/ | ||
COPY start.sh /opt/app/start.sh | ||
|
||
|
||
|
||
|
||
RUN apk add --no-cache nginx yarn openssl && \ | ||
chmod +x /opt/app/start.sh | ||
|
||
RUN apk add --no-cache curl nginx openssl && \ | ||
rm /etc/nginx/http.d/default.conf && \ | ||
mv /home/node/default.conf /etc/nginx/http.d/ && \ | ||
chmod +x /home/node/start.sh | ||
|
||
STOPSIGNAL SIGINT | ||
|
||
HEALTHCHECK --interval=30s --timeout=30s --start-period=10s --retries=3 \ | ||
CMD [ "curl", "-f", "http://localhost:3001", "||", "exit", "1" ] | ||
|
||
CMD ["/home/node/start.sh"] | ||
CMD ["/opt/app/start.sh"] | ||
|
||
STOPSIGNAL SIGTERM |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
version: '3.0' | ||
|
||
services: | ||
darkwire: | ||
build: . | ||
|
@@ -9,7 +9,7 @@ services: | |
- VITE_API_HOST=localhost | ||
- VITE_API_PROTOCOL=http | ||
- VITE_COMMIT_SHA=some_sha | ||
- VITE_MAX_FILE_SIZE=4 | ||
- VITE_MAX_FILE_SIZE=20 | ||
- MAILGUN_API_KEY=api-key | ||
- MAILGUN_DOMAIN=darkwire.io | ||
- [email protected] | ||
|
@@ -21,7 +21,7 @@ services: | |
networks: | ||
- db | ||
ports: | ||
- 3001:80 | ||
- 3002:80 | ||
- 4001:443 | ||
- 5001:3001 | ||
|
||
|
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