Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Docker and Server Settings #20

Merged
merged 6 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# the base_href if you're serving your front in an url like www.example.com/geoshop
FRONT_HREF=/geoshop
API_BASE_URL=http://localhost:5007
# API_BASE_URL=http://localhost:5007
API_BASE_URL=http://localhost:8000/
# the base href of your backend
ROOTURL=/geoshop_api
# where are metadata and product images? This is concatenated with relative paths coming from backend
MEDIA_URL=https://some.server.com/geoshop_media
# MEDIA_URL=https://some.server.com/geoshop_media
MEDIA_URL=
9 changes: 5 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
# Build with node
FROM node:22.6.0-slim AS builder
WORKDIR /usr/src/app

COPY package*.json ./
WORKDIR /usr/app

COPY package*.json ./.
RUN npm ci

COPY . .

RUN npm run build

# Serve with nginx unpprevileged
FROM nginxinc/nginx-unprivileged:stable

# copy server config
# TODO this config will change
COPY nginx/default.conf /etc/nginx/conf.d/default.conf

# Copy build artifacts
COPY --from=builder /usr/src/app/dist/ /usr/share/nginx/html
COPY --from=builder /usr/app/dist/ /usr/share/nginx/html
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ DOCKER_TAG ?= latest

export DOCKER_BUILDKIT=1


.DEFAULT_GOAL := help

.PHONY: install
Expand Down
12 changes: 2 additions & 10 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,10 @@
"projects": {
"front": {
"i18n": {
"sourceLocale": "en-US",
"sourceLocale": "fr-CH",
"locales": {
"de": {
"translation": "src/locale/messages.de.xlf"
},
"en": {
"translation": "src/locale/messages.en.xlf"
}
}
},
Expand All @@ -37,6 +34,7 @@
"src/assets/favicon.ico",
"src/assets"
],
"localize": ["de"],
"styles": [
"node_modules/ol/ol.css",
"node_modules/ol-geocoder/dist/ol-geocoder.min.css",
Expand Down Expand Up @@ -91,9 +89,6 @@
"vendorChunk": true,
"buildOptimizer": false
},
"en": {
"localize": ["en"]
},
"de": {
"localize": ["de"]
}
Expand All @@ -112,9 +107,6 @@
"development":{
"browserTarget": "front:build:development"
},
"en": {
"browserTarget": "front:build:development,en"
},
"de": {
"browserTarget": "front:build:development,de"
}
Expand Down
13 changes: 11 additions & 2 deletions nginx/default.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,16 @@ server {
root /usr/share/nginx/html;
index index.html;

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}

location / {
try_files $uri $uri/ =404;
try_files $uri $uri/ /index.html =404;
}

location /welcome {
rewrite ^/welcome/?$ / break;
}
}
}
4 changes: 2 additions & 2 deletions src/assets/configs/config.json.tmpl
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"apiUrl": "${API_BASE_URL}${ROOTURL}",
"apiUrl": "${API_BASE_URL}/${API_ROOTURL}",
"mediaUrl": "${MEDIA_URL}",
"baseMapUrl": "https://wmts.geo.admin.ch/1.0.0/{layer}/{style}/current/{TileMatrixSet}/{TileMatrix}/{TileCol}/{TileRow}",
"geocoderUrl": "https://sitn.ne.ch/search",
"geocoderUrl": "https://nominatim.openstreetmap.org/search",
"geocoderLayers": [
"adresses_sitn", "nom_local_lieu_dit", "search_cours_eau",
"batiments_ofs", "axe_rue", "ImmeublesCanton", "communes", "cadastres",
Expand Down