chore: add development workflow with compose watch

This commit is contained in:
Alexander Navarro 2025-02-05 16:47:26 -03:00
parent f937122a2a
commit 9194eccab9
4 changed files with 41 additions and 8 deletions

View file

@ -1,7 +1,22 @@
# FROM ghcr.io/linuxcontainers/debian-slim:latest
FROM lovasoa/sqlpage
FROM ghcr.io/linuxcontainers/debian-slim:latest
COPY --from=ghcr.io/amacneil/dbmate /usr/local/bin/dbmate /usr/local/bin/dbmate
COPY --from=lovasoa/sqlpage:latest /usr/local/bin/sqlpage /usr/local/bin/sqlpage
COPY --from=lovasoa/sqlpage:latest /lib/libgcc_s.so.1 /lib/libgcc_s.so.1
WORKDIR /app
ENV SQLPAGE_WEB_ROOT=/app
ENV SQLPAGE_CONFIGURATION_DIRECTORY=/etc/sqlpage
RUN addgroup --gid 1000 --system index_user && \
adduser --uid 1000 --system --no-create-home --ingroup index_user index_user && \
mkdir -p /etc/sqlpage && \
touch /etc/sqlpage/sqlpage.db && \
chown -R index_user:index_user /etc/sqlpage/sqlpage.db
COPY --chown=index_user:index_user ./src /app
USER index_user
CMD /usr/local/bin/sqlpage

View file

@ -2,13 +2,17 @@ services:
index:
image: alecodes/index:latest
pull_policy: build
user: 1000:1000
build:
context: ..
dockerfile: ./docker/Dockerfile
develop:
watch:
- action: sync
path: ../src
target: /app
ports:
- 3000:8080
env_file: ../.env
volumes:
- ../src:/app
db:
image: postgres:17

View file

@ -1,5 +1,13 @@
-- migrate:up
CREATE TABLE public.sources (
id serial PRIMARY KEY,
name character varying(20) NOT NULL,
uid character varying(8) NOT NULL,
uri character varying NOT NULL,
created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
updated_at timestamp with time zone,
deleted_at timestamp with time zone
);
-- migrate:down
DROP TABLE public.sources;

6
src/index.sql Normal file
View file

@ -0,0 +1,6 @@
SELECT 'list' AS component,
'Popular websites TESTOOO' AS title;
SELECT 'Hello' AS title,
'world' AS description,
'https://wikipedia.org' AS link;