diff --git a/docker-compose-staging.yml b/docker-compose-staging.yml new file mode 100644 index 0000000..b567a0b --- /dev/null +++ b/docker-compose-staging.yml @@ -0,0 +1,46 @@ +version: '3.7' +services: + + database: + image: postgres:12.2-alpine + networks: + - hostnet + volumes: + - /var/lib/postgresql/data/pgdata:/var/lib/postgresql/data/pgdata + environment: + - POSTGRES_USER=localeat + - POSTGRES_PASSWORD=localeat + - PGDATA=/var/lib/postgresql/data/pgdata + + core: + build: + context: "." + dockerfile: ./core/Dockerfile + image: benjaminpochat/localeat-core-staging:${DOCKER_IMAGE_TAG:-latest} + networks: + - hostnet + depends_on: + - database + environment: + - localeat_datasource_url=jdbc:postgresql://localhost:5432/localeat + - localeat_datasource_username=localeat + - localeat_datasource_password=localeat + - localeat_smtp_username=la.viande.en.direct@gmail.com + - localeat_smtp_password=localeat + + ui: + build: + context: "." + dockerfile: ./ui/Dockerfile + image: benjaminpochat/localeat-ui-staging:${DOCKER_IMAGE_TAG:-latest} + networks: + - hostnet + depends_on: + - core + environment: + - localeat_environment_type=staging + +networks: + hostnet: + external: true + name: host diff --git a/docker-compose.yml b/docker-compose.yml index 58079ce..f1942ed 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -37,6 +37,8 @@ services: - hostnet depends_on: - core + environment: + - localeat_environment_type=production networks: hostnet: diff --git a/scripts/build/build-and-push-images.sh b/scripts/prod/build/build-and-push-images.sh similarity index 100% rename from scripts/build/build-and-push-images.sh rename to scripts/prod/build/build-and-push-images.sh diff --git a/scripts/run/update-stack.sh b/scripts/prod/run/update-stack.sh similarity index 100% rename from scripts/run/update-stack.sh rename to scripts/prod/run/update-stack.sh diff --git a/scripts/staging/build/build-images.sh b/scripts/staging/build/build-images.sh new file mode 100644 index 0000000..d82589d --- /dev/null +++ b/scripts/staging/build/build-images.sh @@ -0,0 +1,3 @@ +export DOCKER_IMAGE_TAG=latest +docker-compose -f docker-compose-staging.yml build + diff --git a/scripts/staging/run/remove-stack.sh b/scripts/staging/run/remove-stack.sh new file mode 100644 index 0000000..38fca42 --- /dev/null +++ b/scripts/staging/run/remove-stack.sh @@ -0,0 +1 @@ +docker stack rm localeat-staging \ No newline at end of file diff --git a/scripts/run/run-database.sh b/scripts/staging/run/run-database.sh similarity index 100% rename from scripts/run/run-database.sh rename to scripts/staging/run/run-database.sh diff --git a/scripts/run/run-psql.sh b/scripts/staging/run/run-psql.sh similarity index 100% rename from scripts/run/run-psql.sh rename to scripts/staging/run/run-psql.sh diff --git a/scripts/staging/run/update-stack.sh b/scripts/staging/run/update-stack.sh new file mode 100644 index 0000000..5a52196 --- /dev/null +++ b/scripts/staging/run/update-stack.sh @@ -0,0 +1,2 @@ +docker-compose pull +docker stack deploy -c docker-compose.yml localeat-staging diff --git a/ui/Dockerfile b/ui/Dockerfile index 3ed0ce1..402793e 100644 --- a/ui/Dockerfile +++ b/ui/Dockerfile @@ -4,7 +4,7 @@ RUN apk update WORKDIR /app COPY ./ui . RUN cd /app && npm set progress=false && npm install -RUN npm run build -- --configuration production +RUN npm run build -- --configuration ${localeat_environment_type} # STEP 2 build an apache image with static website FROM httpd:2.4.41-alpine diff --git a/ui/src/environments/environment.staging.ts b/ui/src/environments/environment.staging.ts index 9480009..443fc32 100644 --- a/ui/src/environments/environment.staging.ts +++ b/ui/src/environments/environment.staging.ts @@ -1,4 +1,4 @@ export const environment = { production: false, - localeatCoreUrl: 'http://vps695750.ovh.net:8080' + localeatCoreUrl: 'http://localhost:8080' };