introduced structure backend packeges and frontend

This commit is contained in:
2024-12-28 16:30:48 +01:00
parent f0017a13e1
commit 48e0708dc9
3606 changed files with 1376938 additions and 341 deletions
+6
View File
@@ -0,0 +1,6 @@
FROM node:21.6-alpine
WORKDIR /vue_app
expose 8080
CMD ["npm", "run", "serve"]
+29
View File
@@ -0,0 +1,29 @@
# =========== 1) Build stage ===========
FROM golang:1.20-alpine AS builder
# Create and set working directory
WORKDIR /app
# Copy go.mod and go.sum first, then download dependencies
COPY go.mod go.sum ./
RUN go mod download
# Copy the rest of the backend code
COPY . .
# Build the Go binary
RUN go build -o server main.go
# =========== 2) Runtime stage ===========
FROM alpine:3.18
WORKDIR /app
# Copy the compiled binary from builder stage
COPY --from=builder /app/server /app
# Expose port 8080 (or your backend port)
EXPOSE 8080
# Run the Go server
CMD ["./server"]
+27
View File
@@ -0,0 +1,27 @@
# =========== 1) Build stage ===========
FROM node:18-alpine AS build
WORKDIR /usr/src/app
# Copy package manifests and install dependencies
COPY package*.json ./
RUN npm install
# Copy the rest of the frontend code
COPY . .
# Build the production bundle
RUN npm run build
# =========== 2) Serve stage ===========
FROM nginx:alpine
# Copy production build to Nginx html folder.
# Adjust /usr/src/app/build -> /usr/src/app/dist if youre using Angular/Vue
COPY --from=build /usr/src/app/build /usr/share/nginx/html
# Expose HTTP port
EXPOSE 80
# Run Nginx in foreground
CMD ["nginx", "-g", "daemon off;"]
+28
View File
@@ -0,0 +1,28 @@
#FROM node:14
FROM node:21.6-slim
RUN apt update; apt install -y curl
WORKDIR /vue-setup
RUN npm install -g @vue/cli
RUN npm install -g vite
# The following commands ensure access to our files
# If we left them out, changing files on our local setup
# would fail due to insufficient permissions.
RUN userdel -r node
ARG USER_ID
ARG GROUP_ID
RUN addgroup --gid $GROUP_ID user
RUN adduser --disabled-password --gecos '' --uid $USER_ID --gid $GROUP_ID user
# Set the active user and open the interactive terminal
USER user
ENTRYPOINT [ "bash" ]
+4
View File
@@ -0,0 +1,4 @@
# Build an image named vue_helper using the Setup.Dockerfile
# The build args manage permissions when executing commands from inside the container
#
docker build -f ./dockerfiles/Dev.Dockerfile -t vue_app:dev vue_app
+7
View File
@@ -0,0 +1,7 @@
# Build an image named vue_helper using the Setup.Dockerfile
# The build args manage permissions when executing commands from inside the container
#
docker build \
--build-arg USER_ID=$(id -u) \
--build-arg GROUP_ID=$(id -g) \
-t vue_helper:slim - < ./dockerfiles/Setup.Dockerfile
+49
View File
@@ -0,0 +1,49 @@
version: "3.8"
services:
mariadb:
image: mariadb:10.7
container_name: my_mariadb
environment:
- MYSQL_ROOT_PASSWORD=1234
- MYSQL_DATABASE=rollenspiel_db
ports:
- "3306:3306"
volumes:
- db_data:/var/lib/mysql
command: ['--character-set-server=utf8mb4', '--collation-server=utf8mb4_unicode_ci']
backend:
build:
context: ../backend
dockerfile: Dockerfile
container_name: backend
# environment:
# - YOUR_ENV=example
environment:
DB_HOST: mariadb
DB_USER: root
DB_PASS: 1234
DB_NAME: rollenspiel_db
ports:
- "8080:8080"
# volumes:
# - ./some-local-folder:/app/some-folder
# You can add more configuration as needed.
depends_on:
- mariadb
frontend:
build:
context: ../frontend
dockerfile: Dockerfile.frontend
container_name: frontend
ports:
- "3000:80"
depends_on:
- backend
# environment:
# - API_URL=http://backend:8080
# In your frontend code, you'd reference process.env.API_URL or similar
# if using environment variables at build time.
volumes:
db_data:
+3
View File
@@ -0,0 +1,3 @@
docker run -v /data/dev/bamort/bamort:/vue_app \
-p 8080:8080 \
-it vue_app:dev
+1
View File
@@ -0,0 +1 @@
docker run --rm -ti -v /data/dev/bamort:/vue-setup vue_helper:slim