Skip to content

Commit 9269d41

Browse files
authored
fix: update Dockerfile and docker-compose.yml to change port from 8080 to 8000 (#240)
1 parent 8ad6bf6 commit 9269d41

File tree

5 files changed

+17
-15
lines changed

5 files changed

+17
-15
lines changed

Dockerfile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@ RUN --mount=type=cache,target=/root/.cache \
2121
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
2222
uv sync --locked --no-dev --no-install-project
2323

24-
COPY . /src
25-
WORKDIR /src
24+
COPY ./src /src
2625

2726
# Install the application into the build environment.
2827
# We won't need the source code in the production image,
2928
# only the installed packages.
3029
RUN --mount=type=cache,target=/root/.cache \
30+
--mount=type=bind,source=uv.lock,target=uv.lock \
31+
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
3132
uv sync --locked --no-dev --no-editable
3233

33-
3434
FROM python AS app
3535

3636
# Add the virtualenv to PATH
@@ -40,12 +40,12 @@ ENV PATH="/app/bin:${PATH}"
4040
RUN addgroup -S nonroot && adduser -S nonroot -G nonroot
4141

4242
# Copy the pre-built /app virtualenv and change ownership to nonroot
43-
COPY --from=builder --chown=nonroot:nonroot /app /app
43+
COPY --from=builder --chown=nonroot:nonroot --chmod=500 /app /app
4444

4545
USER nonroot:nonroot
4646
WORKDIR /app
4747

4848
ENV SERVER_BASE_PATH="/home/nonroot/assets"
49-
CMD ["uvicorn", "bss_web_file_server.main:app", "--host", "0.0.0.0", "--port", "8080"]
49+
CMD ["fastapi", "run", "--entrypoint", "bss_web_file_server.main:app"]
5050

51-
EXPOSE 8080
51+
EXPOSE 8000

docker-compose.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ services:
33
build:
44
context: .
55
ports:
6-
- "8080"
6+
- "8000"
77
environment:
88
SERVER_BASE_PATH: /home/nonroot/assets
99
healthcheck:
10-
test: python -c "import requests, sys; sys.exit(0 if 'UP' in requests.get('http://localhost:8080/health').text else 1)"
10+
test: python -c "import requests, sys; sys.exit(0 if 'UP' in requests.get('http://localhost:8000/health').text else 1)"
1111
start_period: 2s
1212
interval: 10s
1313
timeout: 5s

scripts/convert-image.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
#!/usr/bin/env sh
2-
if [ "$#" -ne 2 ]; then
1+
#!/bin/bash
2+
3+
if [[ "$#" -ne 2 ]]; then
34
echo "1st argument: input image"
45
echo "2nd argument: output folder"
56
exit

scripts/convert-poster.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
#!/usr/bin/env sh
2-
if [ "$#" -ne 2 ]; then
1+
#!/bin/bash
2+
3+
if [[ "$#" -ne 2 ]]; then
34
echo "1st argument: input image"
45
echo "2nd argument: output folder"
56
exit

tests-int/test_health.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ def compose():
1414
compose_file_name="docker-compose.yml",
1515
build=True,
1616
)
17-
compose.waiting_for({"app": LogMessageWaitStrategy("8080")})
17+
compose.waiting_for({"app": LogMessageWaitStrategy("8000")})
1818
compose.start()
1919
yield compose
2020
compose.stop()
2121

2222

2323
def test_health(compose: DockerCompose):
2424
host = compose.get_service_host("app")
25-
port = compose.get_service_port("app", 8080)
25+
port = compose.get_service_port("app", 8000)
2626
assert "Application startup complete." in compose.get_logs("app")[0]
2727
response = requests.get(f"http://{host}:{port}/health")
2828
assert response.status_code == 200
@@ -31,7 +31,7 @@ def test_health(compose: DockerCompose):
3131

3232
def test_ping(compose: DockerCompose):
3333
host = compose.get_service_host("app")
34-
port = compose.get_service_port("app", 8080)
34+
port = compose.get_service_port("app", 8000)
3535
response = requests.get(f"http://{host}:{port}/ping")
3636
assert response.status_code == 200
3737
assert response.text == "PONG"

0 commit comments

Comments
 (0)