Added production docker setup
This commit is contained in:
parent
5799882c62
commit
d5afc59973
3 changed files with 60 additions and 1 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
|
@ -44,4 +44,6 @@ Thumbs.db
|
||||||
.github/instructions/nx.instructions.md
|
.github/instructions/nx.instructions.md
|
||||||
|
|
||||||
vite.config.*.timestamp*
|
vite.config.*.timestamp*
|
||||||
vitest.config.*.timestamp*
|
vitest.config.*.timestamp*
|
||||||
|
|
||||||
|
.env
|
||||||
26
compose/prod/api/Dockerfile
Normal file
26
compose/prod/api/Dockerfile
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
FROM node:18-alpine AS builder
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
LABEL org.opencontainers.image.source="TBC"
|
||||||
|
LABEL org.opencontainers.image.description="FYP Image"
|
||||||
|
|
||||||
|
COPY package*.json ./
|
||||||
|
|
||||||
|
RUN npm ci
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
RUN npm run build:api
|
||||||
|
|
||||||
|
FROM node:18-alpine
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
RUN npm install -g serve
|
||||||
|
|
||||||
|
COPY --from=builder /app/dist /app/dist
|
||||||
|
|
||||||
|
CMD ["serve", "-s", "dist", "-l", "3000"]
|
||||||
|
|
||||||
|
EXPOSE 3000
|
||||||
31
compose/prod/docker-compose.yml
Normal file
31
compose/prod/docker-compose.yml
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
|
||||||
|
|
||||||
|
services:
|
||||||
|
fyp-web:
|
||||||
|
image: ${IMAGE}
|
||||||
|
restart: unless-stopped
|
||||||
|
deploy:
|
||||||
|
mode: replicated
|
||||||
|
replicas: ${REPLICAS}
|
||||||
|
labels:
|
||||||
|
- "traefik.enable=true"
|
||||||
|
- "traefik.http.routers.web-fishy.rule=Host(`${DOMAIN}`)"
|
||||||
|
- "traefik.http.routers.web-fishy.entrypoints=${ENTRYPOINT}"
|
||||||
|
- "traefik.http.routers.web-fishy.tls.certresolver=${CERTRESOLVER}"
|
||||||
|
- "com.centurylinklabs.watchtower.enable=true"
|
||||||
|
networks:
|
||||||
|
- proxy
|
||||||
|
|
||||||
|
fyp-watchtower:
|
||||||
|
image: containrrr/watchtower
|
||||||
|
command:
|
||||||
|
- "--label-enable"
|
||||||
|
- "--interval"
|
||||||
|
- "30"
|
||||||
|
- "--rolling-restart"
|
||||||
|
volumes:
|
||||||
|
- "/var/run/docker.sock:/var/run/docker.sock"
|
||||||
|
|
||||||
|
networks:
|
||||||
|
proxy:
|
||||||
|
external: true
|
||||||
Loading…
Reference in a new issue