feat: add Docker support with Dockerfile and docker-compose, update API URLs to use base_url

This commit is contained in:
2026-03-14 20:56:21 -03:00
parent 6a78cb41d8
commit b6e4aa7622
27 changed files with 110 additions and 25 deletions
+4 -1
View File
@@ -12,7 +12,10 @@
"Bash(grep -rE '\"\"@adapters\"\"' tsconfig*.json babel.config.*)", "Bash(grep -rE '\"\"@adapters\"\"' tsconfig*.json babel.config.*)",
"Bash(grep -n \"pub struct Line\\\\|pub fn add_shape\\\\|fn add_polygon\\\\|fn add_rect\\\\|PdfLayerReference\" /home/felipecn/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/printpdf-0.7.0/src/*.rs)", "Bash(grep -n \"pub struct Line\\\\|pub fn add_shape\\\\|fn add_polygon\\\\|fn add_rect\\\\|PdfLayerReference\" /home/felipecn/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/printpdf-0.7.0/src/*.rs)",
"mcp__paper__get_basic_info", "mcp__paper__get_basic_info",
"mcp__paper__get_screenshot" "mcp__paper__get_screenshot",
"Bash(find /var/home/felipecn/DEV/MeowSpool/backend/bruno-routes -name \"*.yml\" ! -name \"route.yml\" -exec sed -i 's|http://0\\\\.0\\\\.0\\\\.0:8080|{{base_url}}|g; s|https://meowspool\\\\.felipecncloud\\\\.com|{{base_url}}|g' {} +)",
"Bash(find /var/home/felipecn/DEV/MeowSpool/backend/bruno-routes -name \"*.yml\" ! -name \"route.yml\" ! -name \"Dashboard.yml\" -exec sed -i 's| url: \\\\\\({{.*}}\\\\\\)| url: \"\"\\\\1\"\"|g' {} +)",
"Bash(find /var/home/felipecn/DEV/MeowSpool/backend/bruno-routes -name \"*.yml\" ! -name \"route.yml\" -exec sed -i 's| url: \"\"\\\\?\\\\\\(.*\\\\\\)\"\"\\\\?$| url: \"\"\\\\1\"\"|g; s| url: \"\"\\\\\\(.*\\\\\\)\"\"\"\"\\\\?$| url: \"\"\\\\1\"\"|g' {} +)"
] ]
} }
} }
+5
View File
@@ -0,0 +1,5 @@
target/
.env
.git
.gitignore
*.md
+40
View File
@@ -0,0 +1,40 @@
# ── Stage 1: builder ──────────────────────────────────────────────────────────
FROM rust:1.88-slim-bookworm AS builder
# Build dependencies for native libs (OpenSSL via rustls not needed, but sqlx needs pkg-config)
RUN apt-get update && apt-get install -y --no-install-recommends \
pkg-config \
libssl-dev \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Cache dependency compilation separately from source
COPY Cargo.toml Cargo.lock ./
# Create a dummy main so Cargo can compile deps without our source
RUN mkdir src && echo "fn main() {}" > src/main.rs
RUN cargo build --release --bin meowspool 2>/dev/null; true
# Now copy real source and migrations
COPY src ./src
COPY migrations ./migrations
# Touch main.rs so Cargo knows it changed, then build for real
RUN touch src/main.rs && cargo build --release --bin meowspool
# ── Stage 2: runtime ──────────────────────────────────────────────────────────
FROM debian:bookworm-slim AS runtime
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY --from=builder /app/target/release/meowspool ./meowspool
COPY --from=builder /app/migrations ./migrations
EXPOSE 8080
CMD ["./meowspool"]
@@ -5,7 +5,7 @@ info:
http: http:
method: POST method: POST
url: http://0.0.0.0:8080/api/v1/auth/forgot-password url: "{{base_url}}/api/v1/auth/forgot-password"
body: body:
type: json type: json
data: |- data: |-
@@ -5,7 +5,7 @@ info:
http: http:
method: POST method: POST
url: https://meowspool.felipecncloud.com/api/v1/auth/login url: "{{base_url}}/api/v1/auth/login"
body: body:
type: json type: json
data: |- data: |-
@@ -5,7 +5,7 @@ info:
http: http:
method: POST method: POST
url: http://0.0.0.0:8080/api/v1/auth/logout url: "{{base_url}}/api/v1/auth/logout"
body: body:
type: json type: json
data: |- data: |-
@@ -5,7 +5,7 @@ info:
http: http:
method: POST method: POST
url: http://0.0.0.0:8080/api/v1/auth/oauth/google url: "{{base_url}}/api/v1/auth/oauth/google"
body: body:
type: json type: json
data: |- data: |-
@@ -5,7 +5,7 @@ info:
http: http:
method: POST method: POST
url: http://0.0.0.0:8080/api/v1/auth/refresh url: "{{base_url}}/api/v1/auth/refresh"
body: body:
type: json type: json
data: |- data: |-
@@ -5,7 +5,7 @@ info:
http: http:
method: POST method: POST
url: http://0.0.0.0:8080/api/v1/auth/register url: "{{base_url}}/api/v1/auth/register"
body: body:
type: json type: json
data: |- data: |-
@@ -5,7 +5,7 @@ info:
http: http:
method: POST method: POST
url: http://0.0.0.0:8080/api/v1/auth/reset-password url: "{{base_url}}/api/v1/auth/reset-password"
body: body:
type: json type: json
data: |- data: |-
@@ -5,7 +5,7 @@ info:
http: http:
method: POST method: POST
url: http://0.0.0.0:8080/api/v1/auth/verify-email url: "{{base_url}}/api/v1/auth/verify-email"
body: body:
type: json type: json
data: |- data: |-
+1 -1
View File
@@ -5,7 +5,7 @@ info:
http: http:
method: GET method: GET
url: http://0.0.0.0:8080/api/v1/dashboard url: "{{base_url}}/api/v1/dashboard"
auth: auth:
type: bearer type: bearer
token: "{{access_token}}" token: "{{access_token}}"
@@ -5,7 +5,7 @@ info:
http: http:
method: POST method: POST
url: http://0.0.0.0:8080/api/v1/filaments url: "{{base_url}}/api/v1/filaments"
body: body:
type: json type: json
data: |- data: |-
@@ -5,7 +5,7 @@ info:
http: http:
method: DELETE method: DELETE
url: http://0.0.0.0:8080/api/v1/filaments/{{filament_id}} url: "{{base_url}}/api/v1/filaments/{{filament_id}}"
auth: auth:
type: bearer type: bearer
token: "{{access_token}}" token: "{{access_token}}"
@@ -5,7 +5,7 @@ info:
http: http:
method: GET method: GET
url: http://0.0.0.0:8080/api/v1/filaments/{{filament_id}}/label.svg url: "{{base_url}}/api/v1/filaments/{{filament_id}}/label.svg"
params: params:
- name: width_mm - name: width_mm
value: "80" value: "80"
@@ -5,7 +5,7 @@ info:
http: http:
method: GET method: GET
url: http://0.0.0.0:8080/api/v1/filaments/{{filament_id}} url: "{{base_url}}/api/v1/filaments/{{filament_id}}"
auth: auth:
type: bearer type: bearer
token: "{{access_token}}" token: "{{access_token}}"
@@ -5,7 +5,7 @@ info:
http: http:
method: GET method: GET
url: http://0.0.0.0:8080/api/v1/filaments/{{filament_id}}/qrcode url: "{{base_url}}/api/v1/filaments/{{filament_id}}/qrcode"
auth: auth:
type: bearer type: bearer
token: "{{access_token}}" token: "{{access_token}}"
@@ -5,7 +5,7 @@ info:
http: http:
method: GET method: GET
url: http://0.0.0.0:8080/api/v1/filaments url: "{{base_url}}/api/v1/filaments"
params: params:
- name: page - name: page
value: "1" value: "1"
@@ -5,7 +5,7 @@ info:
http: http:
method: PUT method: PUT
url: http://0.0.0.0:8080/api/v1/filaments/{{filament_id}} url: "{{base_url}}/api/v1/filaments/{{filament_id}}"
body: body:
type: json type: json
data: |- data: |-
@@ -5,7 +5,7 @@ info:
http: http:
method: POST method: POST
url: http://0.0.0.0:8080/api/v1/spool-presets url: "{{base_url}}/api/v1/spool-presets"
body: body:
type: json type: json
data: |- data: |-
@@ -5,7 +5,7 @@ info:
http: http:
method: DELETE method: DELETE
url: http://0.0.0.0:8080/api/v1/spool-presets/{{preset_id}} url: "{{base_url}}/api/v1/spool-presets/{{preset_id}}"
auth: auth:
type: bearer type: bearer
token: "{{access_token}}" token: "{{access_token}}"
@@ -5,7 +5,7 @@ info:
http: http:
method: GET method: GET
url: http://0.0.0.0:8080/api/v1/spool-presets url: "{{base_url}}/api/v1/spool-presets"
auth: auth:
type: bearer type: bearer
token: "{{access_token}}" token: "{{access_token}}"
@@ -5,7 +5,7 @@ info:
http: http:
method: PUT method: PUT
url: http://0.0.0.0:8080/api/v1/spool-presets/{{preset_id}} url: "{{base_url}}/api/v1/spool-presets/{{preset_id}}"
body: body:
type: json type: json
data: |- data: |-
@@ -5,7 +5,7 @@ info:
http: http:
method: GET method: GET
url: http://0.0.0.0:8080/api/v1/users/me url: "{{base_url}}/api/v1/users/me"
auth: auth:
type: bearer type: bearer
token: "{{access_token}}" token: "{{access_token}}"
@@ -5,7 +5,7 @@ info:
http: http:
method: PUT method: PUT
url: http://0.0.0.0:8080/api/v1/users/me url: "{{base_url}}/api/v1/users/me"
body: body:
type: json type: json
data: |- data: |-
@@ -1,10 +1,12 @@
name: route name: route
variables: variables:
- name: base_url
value: https://meowspool.felipecncloud.com
- secret: true - secret: true
name: access_token name: access_token
- secret: true - secret: true
name: refresh_token name: refresh_token
- name: preset_id - name: preset_id
value: 88eab1b9-e979-46db-940f-59cac97df60b value: 07188f3b-2b74-4251-88bc-037de7628d65
- name: filament_id - name: filament_id
value: da5e431c-bc2e-4075-aa1c-ce82ee9567b4 value: ""
+35
View File
@@ -0,0 +1,35 @@
services:
db:
image: postgres:16-alpine
restart: unless-stopped
env_file: .env
environment:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB}
volumes:
- postgres_data:/var/lib/postgresql/data
ports:
- "${POSTGRES_PORT:-5432}:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER}"]
interval: 5s
timeout: 5s
retries: 5
backend:
build:
context: ./backend
dockerfile: Dockerfile
restart: unless-stopped
env_file: .env
environment:
DATABASE_URL: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB}
ports:
- "${PORT:-8080}:8080"
depends_on:
db:
condition: service_healthy
volumes:
postgres_data: