Skip to content

Commit 7653c0c

Browse files
committed
Add s6
1 parent cb926cc commit 7653c0c

File tree

6 files changed

+24
-4
lines changed

6 files changed

+24
-4
lines changed

Dockerfile

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,28 @@ WORKDIR /tmp/frontend
5353
RUN ["npx", "openapi-typescript", "/tmp/openapi.json", "-o", "src/api/schema.d.ts"]
5454
RUN ["npm", "run", "build"]
5555

56-
FROM python:3.12-slim as production
56+
FROM python:3.12-slim-bookworm as production
57+
58+
ARG S6_OVERLAY_VERSION=3.1.6.2
59+
60+
RUN apt update && apt install -y wget xz-utils
61+
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-noarch.tar.xz /tmp/
62+
RUN tar -C / -Jxpf /tmp/s6-overlay-noarch.tar.xz
63+
RUN cd /tmp/ && wget -q https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-$(uname -m).tar.xz
64+
RUN tar -C / -Jxpf /tmp/s6-overlay-$(uname -m).tar.xz
65+
COPY ./s6 /etc/s6-overlay/s6-rc.d/
66+
67+
ENV S6_KEEP_ENV=1
68+
ENV S6_BEHAVIOUR_IF_STAGE2_FAILS=2
69+
ENV S6_VERBOSITY=1
5770

5871
COPY --from=build-server-deps /venv /venv
59-
COPY src/main.py .
72+
COPY src/main.py ./src/main.py
6073
COPY --from=build-frontend /tmp/frontend/dist ./frontend/dist
6174
ENV PATH="/venv/bin:$PATH"
6275

63-
ENTRYPOINT [ "python3", "-m", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000", "--proxy-headers" ]
76+
CMD [ "python3", "-m", "uvicorn", "src.main:app", "--host", "0.0.0.0", "--port", "8000", "--proxy-headers" ]
77+
78+
EXPOSE 8000
6479

65-
EXPOSE 8000
80+
ENTRYPOINT [ "/init" ]

s6/pre-migrate/dependencies.d/base

Whitespace-only changes.

s6/pre-migrate/run

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/command/execlineb -P
2+
# vim: set syntax=sh :
3+
4+
python3 -m alembic upgrade head

s6/pre-migrate/type

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
oneshot

s6/pre-migrate/up

Whitespace-only changes.

s6/user/contents.d/pre-migrate

Whitespace-only changes.

0 commit comments

Comments
 (0)