From 9175a9b40c1a83d5809fde4616d00d88f6f2bf80 Mon Sep 17 00:00:00 2001 From: Lucas Pirola Date: Tue, 9 Jul 2024 21:58:15 -0300 Subject: [PATCH] =?UTF-8?q?Adiciona=20build=20como=20padr=C3=A3o=20no=20do?= =?UTF-8?q?cker=20compose?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/Dockerfile | 26 +++++++++++++------------- compose.yaml | 47 ++++++++++++++++++++++++++++------------------- 2 files changed, 41 insertions(+), 32 deletions(-) diff --git a/api/Dockerfile b/api/Dockerfile index 6a100bb2c6..54bd587fdc 100644 --- a/api/Dockerfile +++ b/api/Dockerfile @@ -2,17 +2,17 @@ # Adapted from https://github.com/dunglas/symfony-docker -# FROM node:20 as frontend_build - -# # user: "node" -# WORKDIR /app -# # environment: -# ENV NODE_ENV=development -# COPY . /app -# WORKDIR /app/mapas/src -# RUN npm i -g pnpm -# RUN pnpm i -# RUN pnpm run dev +FROM node:20 as frontend_build + +# user: "node" +WORKDIR /app +# environment: +ENV NODE_ENV=development +COPY --link . /app +WORKDIR /app/mapas/src +RUN npm i -g pnpm +RUN pnpm i +RUN pnpm run dev # Versions FROM dunglas/frankenphp:1-php8.3 AS frankenphp_upstream @@ -29,7 +29,7 @@ FROM frankenphp_upstream AS frankenphp_base WORKDIR /app # COPY --link . /app -# COPY --link --from=frontend_build /app /app +COPY --link --from=frontend_build /app /app # persistent / runtime deps # hadolint ignore=DL3008 @@ -67,7 +67,7 @@ FROM frankenphp_base AS frankenphp_dev ENV APP_ENV=dev XDEBUG_MODE=off # VOLUME /app/var/ -COPY --link . /app +# COPY --link . /app RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini" diff --git a/compose.yaml b/compose.yaml index 5dfc8e81a1..fe4489201e 100644 --- a/compose.yaml +++ b/compose.yaml @@ -1,4 +1,11 @@ x-defaults: &defaults + build: + context: ./api + target: frankenphp_dev + + # volumes: + # - ./api:/app + environment: &environment PWA_UPSTREAM: ${PWA_UPSTREAM} SERVER_NAME: ${SERVER_NAME} @@ -31,11 +38,8 @@ services: - db-update environment: <<: *environment - # build: - # context: ./api - # target: frankenphp_dev ports: - - 5020:80 + - 80 volumes: # - ./api:/app # - /app/var @@ -45,16 +49,18 @@ services: # - ./api/frankenphp/conf.d/app.dev.ini:/usr/local/etc/php/conf.d/app.dev.ini:ro - caddy_data:/data - caddy_config:/config - # pgadmin: - # image: dpage/pgadmin4 - # environment: - # PGADMIN_DEFAULT_EMAIL: ${PGADMIN_DEFAULT_EMAIL:-pgadmin4@pgadmin.org} - # PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_DEFAULT_PASSWORD:-admin} - # PGADMIN_CONFIG_SERVER_MODE: 'False' - # volumes: - # - pgadmin:/var/lib/pgadmin - # ports: - # - 5050:80 + + pgadmin: + image: dpage/pgadmin4 + environment: + PGADMIN_DEFAULT_EMAIL: ${PGADMIN_DEFAULT_EMAIL:-pgadmin4@pgadmin.org} + PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_DEFAULT_PASSWORD:-admin} + PGADMIN_CONFIG_SERVER_MODE: 'False' + volumes: + - pgadmin:/var/lib/pgadmin + ports: + - 80 + crontab: image: rancher/container-crontab:v0.5.0 restart: '${DOCKER_RESTART_POLICY:-always}' @@ -108,19 +114,20 @@ services: command: --maxmemory 128Mb --maxmemory-policy allkeys-lru volumes: - redis:/data - + ports: + - 6379 sessions: image: redis:6 restart: unless-stopped command: --maxmemory 128Mb --maxmemory-policy allkeys-lru volumes: - sessions:/data - + ports: + - 6379 mailhog: image: mailhog/mailhog - # ports: - # - "8025:8025" - + ports: + - 8025 # pwa: # image: redemapas/mapas-pwa # build: @@ -145,6 +152,8 @@ services: #- ./api/mapas/dev/db:/docker-entrypoint-initdb.d # you may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data! # - ./api/docker/db/data:/var/lib/postgresql/data + ports: + - 5432 healthcheck: test: "PGPASSWORD=${POSTGRES_PASSWORD} pg_isready -h 127.0.0.1 -U ${POSTGRES_USER} -d ${POSTGRES_DB}"