Compare commits

..

5 Commits

Author SHA1 Message Date
99e1cd5639 Update dockerfile; update compose 2025-04-21 12:02:33 -07:00
7446d8296a update compose 2025-04-21 11:52:32 -07:00
6b424ae8e4 Update compose 2025-04-21 11:51:22 -07:00
04489a53d1 Update compose 2025-04-21 11:47:09 -07:00
b40134833b Update compose; remove prisma schema 2025-04-21 11:28:32 -07:00
10 changed files with 36 additions and 86 deletions

View File

@@ -1,5 +1,5 @@
timmypidashev.local { timmypidashev.local {
tls internal tls internal
reverse_proxy web:4321 reverse_proxy timmypidashev.dev:4321
} }

View File

@@ -1,5 +1,5 @@
timmypidashev.dev { timmypidashev.dev {
tls pidashev.tim@gmail.com tls pidashev.tim@gmail.com
reverse_proxy 127.0.0.1:3000 reverse_proxy timmypidashev.dev:3000
} }

View File

@@ -36,10 +36,13 @@ FROM node:22-alpine
WORKDIR /app WORKDIR /app
# Install serve # Install serve
RUN npm install -g serve RUN npm install -g http-server
# Copy built files # Copy built files
COPY --from=builder /app/dist ./dist COPY --from=builder /app/dist ./dist
# Expose port 3000
EXPOSE 3000 EXPOSE 3000
CMD ["serve", "-s", "dist", "-l", "3000"]
# Deployment command
CMD ["http-server", "dist", "-a", "127.0.0.1", "-p", "3000"]

View File

@@ -1,13 +1,13 @@
PROJECT_NAME := "timmypidashev.dev" PROJECT_NAME := "timmypidashev.dev"
PROJECT_AUTHORS := "Timothy Pidashev (timmypidashev) <pidashev.tim@gmail.com>" PROJECT_AUTHORS := "Timothy Pidashev (timmypidashev) <pidashev.tim@gmail.com>"
PROJECT_VERSION := "v1.0.1" PROJECT_VERSION := "v1.0.2"
PROJECT_LICENSE := "MIT" PROJECT_LICENSE := "MIT"
PROJECT_SOURCES := "https://github.com/timmypidashev/web" PROJECT_SOURCES := "https://github.com/timmypidashev/web"
PROJECT_REGISTRY := "ghcr.io/timmypidashev/web" PROJECT_REGISTRY := "ghcr.io/timmypidashev"
PROJECT_ORGANIZATION := "org.opencontainers" PROJECT_ORGANIZATION := "org.opencontainers"
CONTAINER_WEB_NAME := "web" CONTAINER_WEB_NAME := "timmypidashev.dev"
CONTAINER_WEB_VERSION := "v1.0.1" CONTAINER_WEB_VERSION := "v2.1.1"
CONTAINER_WEB_LOCATION := "src/" CONTAINER_WEB_LOCATION := "src/"
CONTAINER_WEB_DESCRIPTION := "My portfolio website!" CONTAINER_WEB_DESCRIPTION := "My portfolio website!"
@@ -17,7 +17,7 @@ CONTAINER_WEB_DESCRIPTION := "My portfolio website!"
help: help:
@echo "Available targets:" @echo "Available targets:"
@echo " run - Runs the docker compose file with the specified environment (dev or release)" @echo " run - Runs the docker compose file with the specified environment (local or release)"
@echo " build - Builds the specified docker image with the appropriate environment" @echo " build - Builds the specified docker image with the appropriate environment"
@echo " push - Pushes the built docker image to the registry" @echo " push - Pushes the built docker image to the registry"
@echo " prune - Removes all built and cached docker images and containers" @echo " prune - Removes all built and cached docker images and containers"
@@ -25,19 +25,19 @@ help:
run: run:
# Arguments: # Arguments:
# [environment]: 'dev' or 'release' # [environment]: 'local' or 'release'
# #
# Explanation: # Explanation:
# * Runs the docker compose file with the specified environment(compose.dev.yml, or compose.release.yml) # * Runs the docker compose file with the specified environment(compose.local.yml, or compose.release.yml)
# * Passes all generated arguments to the compose file. # * Passes all generated arguments to the compose file.
# Make sure we have been given proper arguments. # Make sure we have been given proper arguments.
@if [ "$(word 2,$(MAKECMDGOALS))" = "dev" ]; then \ @if [ "$(word 2,$(MAKECMDGOALS))" = "local" ]; then \
echo "Running in development environment"; \ echo "Running in local environment"; \
elif [ "$(word 2,$(MAKECMDGOALS))" = "release" ]; then \ elif [ "$(word 2,$(MAKECMDGOALS))" = "release" ]; then \
echo "Running in release environment"; \ echo "Running in release environment"; \
else \ else \
echo "Invalid usage. Please use 'make run dev' or 'make run release'"; \ echo "Invalid usage. Please use 'make run local' or 'make run release'"; \
exit 1; \ exit 1; \
fi fi
@@ -47,7 +47,7 @@ run:
build: build:
# Arguments # Arguments
# [container]: Build context(which container to build ['all' to build every container defined]) # [container]: Build context(which container to build ['all' to build every container defined])
# [environment]: 'dev' or 'release' # [environment]: 'local' or 'release'
# #
# Explanation: # Explanation:
# * Builds the specified docker image with the appropriate environment. # * Builds the specified docker image with the appropriate environment.
@@ -155,19 +155,19 @@ define container_build
$(eval ENVIRONMENT := $(word 2,$1)) $(eval ENVIRONMENT := $(word 2,$1))
$(eval ARGS := $(shell echo $(args))) $(eval ARGS := $(shell echo $(args)))
$(eval VERSION := $(strip $(call container_version,$(CONTAINER)))) $(eval VERSION := $(strip $(call container_version,$(CONTAINER))))
$(eval TAG := $(CONTAINER):$(ENVIRONMENT)) $(eval TAG := $(PROJECT_NAME):$(ENVIRONMENT))
@echo "Building container: $(CONTAINER)" @echo "Building container: $(CONTAINER)"
@echo "Environment: $(ENVIRONMENT)" @echo "Environment: $(ENVIRONMENT)"
@echo "Version: $(VERSION)" @echo "Version: $(VERSION)"
@if [ "$(strip $(ENVIRONMENT))" != "dev" ] && [ "$(strip $(ENVIRONMENT))" != "release" ]; then \ @if [ "$(strip $(ENVIRONMENT))" != "local" ] && [ "$(strip $(ENVIRONMENT))" != "release" ]; then \
echo "Invalid environment. Please specify 'dev' or 'release'"; \ echo "Invalid environment. Please specify 'local' or 'release'"; \
exit 1; \ exit 1; \
fi fi
$(if $(filter $(strip $(ENVIRONMENT)),release), \ $(if $(filter $(strip $(ENVIRONMENT)),release), \
$(eval TAG := $(PROJECT_REGISTRY)/$(CONTAINER):$(VERSION)), \ $(eval TAG := $(PROJECT_REGISTRY)/$(PROJECT_NAME):$(VERSION)), \
) )
docker buildx build --load -t $(TAG) -f .docker/Dockerfile.$(ENVIRONMENT) ./$(strip $(subst $(SPACE),,$(call container_location,$(CONTAINER))))/. $(ARGS) $(call labels,$(shell echo $(CONTAINER_NAME) | tr '[:lower:]' '[:upper:]')) --no-cache docker buildx build --load -t $(TAG) -f .docker/Dockerfile.$(ENVIRONMENT) ./$(strip $(subst $(SPACE),,$(call container_location,$(CONTAINER))))/. $(ARGS) $(call labels,$(shell echo $(CONTAINER_NAME) | tr '[:lower:]' '[:upper:]')) --no-cache

View File

@@ -1,35 +0,0 @@
services:
caddy:
container_name: proxy
image: caddy:latest
ports:
- 80:80
- 443:443
volumes:
- ./.caddy/Caddyfile.dev:/etc/caddy/Caddyfile:rw
networks:
- web_proxy
depends_on:
- web
web:
container_name: web
image: web:dev
volumes:
- ./src/node_modules:/app/node_modules
- ./src/sandbox.config.json:/app/sandbox.config.json
- ./src/.stackblitzrc:/app/.stackblitzrc
- ./src/astro.config.mjs:/app/astro.config.mjs
- ./src/tailwind.config.cjs:/app/tailwind.config.cjs
- ./src/tsconfig.json:/app/tsconfig.json
- ./src/pnpm-lock.yaml:/app/pnpm-lock.yaml
- ./src/package.json:/app/package.json
- ./src/public:/app/public
- ./src/src:/app/src
networks:
- web_proxy
networks:
web_proxy:
name: web_proxy
external: true

0
compose.local.yml Normal file
View File

View File

@@ -1,20 +1,28 @@
services: services:
caddy: caddy:
container_name: proxy container_name: caddy
image: caddy:latest image: caddy:latest
ports: ports:
- 80:80 - 80:80
- 443:443 - 443:443
volumes: volumes:
- ./.caddy/Caddyfile.dev:/etc/caddy/Caddyfile:rw - ./.caddy/Caddyfile.release:/etc/caddy/Caddyfile:rw
networks: networks:
- proxy_network - proxy_network
depends_on: depends_on:
- release.timmypidashev.dev - timmypidashev.dev
release.timmypidashev.dev: watchtower:
container_name: updates
image: containrrr/watchtower
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- $HOME/.docker/config.json:/config.json
command: --interval 120 --cleanup --label-enable
timmypidashev.dev:
container_name: timmypidashev container_name: timmypidashev
image: ghcr.io/timmypidashev/timmypidashev.dev:release image: ghcr.io/timmypidashev/timmypidashev.dev:latest
networks: networks:
- proxy_network - proxy_network

View File

@@ -1,6 +1,6 @@
{ {
"name": "src", "name": "src",
"version": "v2.1.0", "version": "2.1.1",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "astro dev --host", "dev": "astro dev --host",

View File

@@ -1,26 +0,0 @@
// schemas/prisma.schema
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql" // or "mysql" or "sqlite" depending on your database
url = env("DATABASE_URL")
}
model User {
id Int @id @default(autoincrement())
githubId Int @unique @map("github_id")
email String @unique
username String
sessions Session[]
@@index([githubId])
}
model Session {
id String @id
userId Int @map("user_id")
expiresAt DateTime @map("expires_at")
user User @relation(fields: [userId], references: [id])
}