pridani portu do dockerfile + traefik example

This commit is contained in:
batmanisko 2023-06-28 19:50:54 +02:00
parent 1a45d40cba
commit d7fa763d5e
4 changed files with 58 additions and 2 deletions

View File

@ -26,9 +26,12 @@ Aplikace sestává ze dvou (tří) modulů.
- [Docker](https://www.docker.com)
- [Docker Compose](https://docs.docker.com/compose)
### Spuštění
### Spuštění s nginx
- `docker compose up --build -d`
### Spuštení s traefik
- `docker compose -f compose-traefik.yml up --build -d`
## TODO
- [x] Umožnit smazání aktuální volby "popelnicí", místo nutnosti vybrat prázdnou položku v selectu
- [x] Přívětivější možnost odhlašování

View File

@ -18,6 +18,6 @@ ENV NODE_ENV production
WORKDIR /app
COPY --from=builder /build .
EXPOSE 3000
RUN yarn global add serve && yarn
CMD ["serve", "-s", "."]

51
compose-traefik.yml Normal file
View File

@ -0,0 +1,51 @@
version: "3"
networks:
proxy:
name: traefik_proxy
services:
traefik:
image: "traefik:latest"
container_name: "traefik"
command:
# - "--log.level=DEBUG"
#- "--log.filePath=/log/traefik.log"
- "--accesslog=true"
#- "--accessLog.filePath=/log/access.log"
- "--api.insecure=false" # pokud chci dashboard
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:80"
#- "--entryPoints.websecure.address=:443"
restart: unless-stopped
networks:
- proxy
ports:
- "${HTTP_PORT:-80}:80"
#- "443:443"
volumes:
#- "./traefik/log:/log"
- "/var/run/docker.sock:/var/run/docker.sock:ro"
- "/etc/timezone:/etc/timezone:ro"
environment:
- "TZ=Europe/Prague"
server:
build:
context: ./server
networks:
- proxy
labels:
- 'traefik.enable=true'
- 'traefik.http.routers.server.rule=Host(`${DOMAIN:-localhost}`) && (PathPrefix(`/socket.io`) || PathPrefix(`/api`))'
client:
build:
context: ./client
ports:
- 3000:3000
networks:
- proxy
labels:
- 'traefik.enable=true'
- 'traefik.http.routers.client.rule=Host(`${DOMAIN:-localhost}`)'

View File

@ -13,4 +13,6 @@ COPY src ./src
RUN yarn install --frozen-lockfile
RUN yarn build
EXPOSE 3001
CMD [ "node", "/app/dist/index.js" ]