- Added Justfile and added Build
- Added init.sql, docker compose and Dockerfile from other Repo
- Created Docker-compose.build file
- updated Css
This commit is contained in:
LogolicusZ 2024-04-05 11:39:54 +02:00
parent ff5a3da14b
commit 2065e06e4d
6 changed files with 118 additions and 3 deletions

32
Dockerfile Normal file
View file

@ -0,0 +1,32 @@
# Builder-Stage
FROM node:20-alpine AS builder
# Setzt das Arbeitsverzeichnis im Container
WORKDIR /git
# Kopiert den Repository-Inhalt in den Container
COPY . .
# Installiert Abhängigkeiten und baut die Site. Ausgabeverzeichnis ist /app/build
RUN yarn install && yarn run build
# Endstufe
FROM caddy:2-alpine
# Setzt das Arbeitsverzeichnis im Container
WORKDIR /app
# Kopiert das Build-Verzeichnis aus der Builder-Stage nach /web
COPY --from=builder /git/build /app
# Caddyfile-Konfiguration, um Dateien aus /web zu bedienen
RUN echo -e ":80 {\n root * /web\n file_server\n}" > /etc/caddy/Caddyfile
# Macht Port 80 frei
EXPOSE 80
# Startet Caddy mit der gegebenen Caddyfile
CMD ["caddy", "run", "--config", "/etc/caddy/Caddyfile", "--adapter", "caddyfile"]
# Befreit das Build-Verzeichnis aus der Builder-Stage
ONBUILD RUN rm -rf /git

37
Justfile Normal file
View file

@ -0,0 +1,37 @@
# Just configuration
set dotenv-load
# Default variables
default_image := 'gitpot.dev/logolicusz/explorecraft_logolcicusz_knockoff:latest'
default_tag := 'latest'
alias dewit := build
# Run dev server by default
default: dev
_install:
yarn install
# Run vite dev server
dev: _install
@echo "Running vite development server..."
yarn run dev --open
# Run vite preview server
preview: _install
@echo "Running vite preview server..."
yarn run build
yarn run preview --open
# Publish container to Gitpot registry
publish image=default_image:
echo "$GITPOT_TOKEN" | docker login gitpot.dev -u $GITPOT_USERNAME --password-stdin
docker push {{image}}
@echo "Published {{image}} successfuly! Use 'docker pull {{image}}' to pull the container."
# build container image with specified runner (default runner: docker)
build tag=default_tag:
@echo "Running with 'docker' and tagging as '{{tag}}'..."
TAG="{{tag}}" docker compose -f docker-compose.build.yml build

9
docker-compose.build.yml Normal file
View file

@ -0,0 +1,9 @@
services:
web:
image: gitpot.dev/logolicusz/explorecraft_logolcicusz_knockoff:${TAG}
build:
context: .
dockerfile: Dockerfile
no_cache: true
ports:
- "3000:80"

30
docker-compose.yml Normal file
View file

@ -0,0 +1,30 @@
services:
db:
container_name: mariadb
image: mariadb:10.5.8
volumes:
- picture_volume:/var/lib/mysql
- /Users/logolicusz/Git/m169-weekly/scripts/init.sql:/docker-entrypoint-initdb.d/init.sql
environment:
MYSQL_ROOT_PASSWORD: rootpassword
MYSQL_DATABASE: picture_db
MYSQL_USER: user
MYSQL_PASSWORD: userpassword
command: --default-authentication-plugin=mysql_native_password
networks:
- internal-bridge
web:
image: gitpot.dev/logolicusz/explorecraft_logolcicusz_knockoff:latest
ports:
- "3000:80"
networks:
- internal-bridge
volumes:
picture_volume:
external: true
networks:
internal-bridge:
driver: bridge

7
init.sql Normal file
View file

@ -0,0 +1,7 @@
CREATE DATABASE IF NOT EXISTS picture_db;
USE picture_db;
CREATE TABLE IF NOT EXISTS pictures (
id INT AUTO_INCREMENT PRIMARY KEY,
url VARCHAR(255) NOT NULL
);

View file

@ -17,7 +17,7 @@ h1, h2, h3, h4, h5, h6, body {
--primary: #7B41F5; --primary: #7B41F5;
--primary-hover: #5d30bc; --primary-hover: #5d30bc;
--primary-focus: rgba(99, 54, 197, 0.250); --primary-focus: rgba(99, 54, 197, 0.250);
--primary-inverse: #FFF; --primary-inverse: #FEFCED;
background-color: #FEFCED; background-color: #FEFCED;
} }
@ -28,7 +28,7 @@ h1, h2, h3, h4, h5, h6, body {
--primary: #C0FE1F; --primary: #C0FE1F;
--primary-hover: #81ab15; --primary-hover: #81ab15;
--primary-focus: rgba(192, 254, 31,0.250); --primary-focus: rgba(192, 254, 31,0.250);
--primary-inverse: #FFF; --primary-inverse: #FEFCED;
background-color: #191816; background-color: #191816;
} }
} }
@ -39,7 +39,7 @@ h1, h2, h3, h4, h5, h6, body {
--primary: #C0FE1F; --primary: #C0FE1F;
--primary-hover: #81ab15; --primary-hover: #81ab15;
--primary-focus: rgba(192, 254, 31,0.250); --primary-focus: rgba(192, 254, 31,0.250);
--primary-inverse: #FFF; --primary-inverse: #FEFCED;
background-color: #191816; background-color: #191816;
} }