M Dockerfile => Dockerfile +5 -6
@@ 1,7 1,7 @@
-LABEL org.opencontainers.image.source https://git.sr.ht/~sara/openverse-slack-reaction
-
FROM python:3.12-alpine
+LABEL org.opencontainers.image.source https://git.sr.ht/~sara/openverse-slack-reaction
+
RUN apk add --update \
curl build-base \
&& rm -rf /var/cache/apk/*
@@ 21,12 21,11 @@ WORKDIR /home/appuser/app
COPY pdm.lock pdm.lock
COPY pyproject.toml pyproject.toml
+COPY src src
+COPY static static
RUN pdm install --prod --frozen-lockfile
-COPY src src
-COPY run.py run.py
-
EXPOSE 54823
-CMD ["pdm", "run", "run.py"]
+CMD ["pdm", "run", "openverse-slack-reaction"]
M compose.prod.yml => compose.prod.yml +0 -1
@@ 4,7 4,6 @@ services:
ports:
- "54823:54823"
volumes:
- - ./:/home/appuser/app:rw,z
- openverse-slack-reaction:/data
env_file:
- .env
M compose.yml => compose.yml +3 -0
@@ 7,6 7,9 @@ services:
image: ""
build:
context: .
+ volumes:
+ - ./src:/home/appuser/app/src:rw,z
+ - ./static:/home/appuser/app/static:rw,z
environment:
ENVIRONMENT: local
M pyproject.toml => pyproject.toml +11 -1
@@ 1,6 1,6 @@
[project]
name = "openverse-slack-reaction"
-version = "1.2.0"
+version = "1.2.0a"
description = "Use Openverse to find reaction images in Slack."
authors = [
{name = "sarayourfriend", email = "git@sarayourfriend.pictures"},
@@ 18,6 18,13 @@ license = {text = "GPL-3.0"}
[project.urls]
Homepage = "https://git.sr.ht/~sara/openverse-slack-reaction"
+[project.scripts]
+openverse-slack-reaction = "openverse_slack_reaction.__main__:main"
+
+[build-system]
+requires = ["pdm-backend"]
+build-backend = "pdm.backend"
+
[tool.pdm]
[tool.pdm.dev-dependencies]
dev = [
@@ 27,3 34,6 @@ dev = [
[tool.pdm.scripts]
lint-install = "pre-commit install"
lint = "pre-commit run {args:--all-files}"
+
+[tool.pdm.build]
+package-dir = "src"
A src/openverse_slack_reaction/__init__.py => src/openverse_slack_reaction/__init__.py +0 -0
R run.py => src/openverse_slack_reaction/__main__.py +1 -1
@@ 2,7 2,7 @@ import uvicorn
import os
-if __name__ == "__main__":
+def main():
is_local = os.getenv("ENVIRONMENT") == "local"
port: int = int(os.getenv("PORT", "54823"))