Skip to content

Commit 255d69f

Browse files
committed
- fix docker permissions. The custom user was causing issues
- fix nginx mimetypes for local dev
1 parent 050e0ce commit 255d69f

File tree

6 files changed

+220
-45
lines changed

6 files changed

+220
-45
lines changed

docker-compose.debugger.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ services:
55
container_name: mapdb-postgres-debugger
66
image: postgres:18
77
volumes:
8-
- ${POSTGRES_DATA_DIR}/debugger-db/:/var/lib/postgresql/18/docker
8+
- ${POSTGRES_DATA_DIR}/debugger-db/:/var/lib/postgresql
99
environment:
1010
- POSTGRES_DB=${POSTGRES_DB}
1111
- POSTGRES_USER=${POSTGRES_USER}

docker-compose.prod.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ services:
33
container_name: mapdb-postgres
44
image: postgres:18
55
volumes:
6-
- ${POSTGRES_DATA_DIR}:/var/lib/postgresql/18/docker
6+
- ${POSTGRES_DATA_DIR}:/var/lib/postgresql
77
environment:
88
- POSTGRES_DB=${POSTGRES_DB}
99
- POSTGRES_USER=${POSTGRES_USER}

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ services:
33
container_name: mapdb-postgres-dev
44
image: postgres:18
55
volumes:
6-
- ${POSTGRES_DATA_DIR}:/var/lib/postgresql/18/docker
6+
- ${POSTGRES_DATA_DIR}:/var/lib/postgresql
77
environment:
88
- POSTGRES_DB=${POSTGRES_DB}
99
- POSTGRES_USER=${POSTGRES_USER}

docker/Dockerfile

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,38 +4,29 @@ FROM python:3.12-bookworm AS base
44
ENV PYTHONDONTWRITEBYTECODE=1
55
ENV PYTHONUNBUFFERED=1
66

7-
# Configurable user setup
8-
ENV USER=cncnet
9-
ENV UID=1000
10-
117
WORKDIR /cncnet-map-api
128

139
# Install system dependencies
1410
RUN apt-get update && apt-get install -y liblzo2-dev libmagic1
1511

16-
# Create non-root user with configurable name and UID
17-
RUN useradd -m -u ${UID} ${USER}
1812

1913
# Copy necessary files for the build
2014
COPY requirements.txt /cncnet-map-api
2115
COPY requirements-dev.txt /cncnet-map-api
2216
COPY web_entry_point.sh /cncnet-map-api
2317

2418
# Set permissions and make script executable
25-
RUN chmod +x /cncnet-map-api/web_entry_point.sh && \
26-
chown -R ${USER}:${USER} /cncnet-map-api
19+
RUN chmod +x /cncnet-map-api/web_entry_point.sh
2720

2821
RUN pip install --upgrade pip
2922

3023
FROM base AS dev
3124
RUN pip install -r ./requirements-dev.txt
32-
USER ${USER}
3325
ENTRYPOINT ["/cncnet-map-api/web_entry_point.sh"]
3426

3527
FROM base AS prod
3628
COPY . /cncnet-map-api
3729
RUN pip install -r ./requirements.txt
38-
USER ${USER}
3930
ENTRYPOINT ["/cncnet-map-api/web_entry_point.sh"]
4031

4132
FROM base AS debugger

docker/nginx.conf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@ http {
1515
alias /usr/share/nginx/html/static/; # The nginx container's mounted volume.
1616
expires 30d;
1717
add_header Cache-Control public;
18+
include /etc/nginx/mime.types;
1819
}
1920

2021
# Serve user uploaded files
2122
location /silo/ {
2223
alias /usr/share/nginx/html/silo/; # The container's mounted volume.
24+
include /etc/nginx/mime.types;
2325
}
2426

2527
# Proxy requests to the Django app running in gunicorn
@@ -29,6 +31,7 @@ http {
2931
proxy_set_header X-Real-IP $remote_addr;
3032
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
3133
proxy_set_header X-Forwarded-Proto $scheme;
34+
proxy_redirect off;
3235
}
3336
}
3437
}

0 commit comments

Comments
 (0)