add docker and deployment files
This commit is contained in:
8
.dockerignore
Normal file
8
.dockerignore
Normal file
@@ -0,0 +1,8 @@
|
||||
.git
|
||||
.env
|
||||
.env.*
|
||||
!.env.example
|
||||
terminal-shop-source/
|
||||
*.db
|
||||
data/
|
||||
docs/
|
||||
13
Dockerfile.api
Normal file
13
Dockerfile.api
Normal file
@@ -0,0 +1,13 @@
|
||||
FROM golang:alpine AS builder
|
||||
WORKDIR /app
|
||||
RUN apk add --no-cache gcc musl-dev
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
COPY . .
|
||||
RUN CGO_ENABLED=1 GOOS=linux go build -o api ./api/main.go
|
||||
|
||||
FROM alpine:3.21
|
||||
RUN apk add --no-cache libc6-compat
|
||||
WORKDIR /root/
|
||||
COPY --from=builder /app/api .
|
||||
CMD ["./api"]
|
||||
11
Dockerfile.ssh
Normal file
11
Dockerfile.ssh
Normal file
@@ -0,0 +1,11 @@
|
||||
FROM golang:alpine AS builder
|
||||
WORKDIR /app
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
COPY . .
|
||||
RUN CGO_ENABLED=0 GOOS=linux go build -o ssh ./main.go
|
||||
|
||||
FROM alpine:3.21
|
||||
WORKDIR /root/
|
||||
COPY --from=builder /app/ssh .
|
||||
CMD TERM=xterm-256color ./ssh
|
||||
41
docker-compose.prod.yml
Normal file
41
docker-compose.prod.yml
Normal file
@@ -0,0 +1,41 @@
|
||||
services:
|
||||
api:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile.api
|
||||
restart: unless-stopped
|
||||
env_file: .env.prod
|
||||
volumes:
|
||||
- ./data:/data
|
||||
expose:
|
||||
- "8080"
|
||||
|
||||
ssh:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile.ssh
|
||||
restart: unless-stopped
|
||||
env_file: .env.prod
|
||||
ports:
|
||||
- "22:22"
|
||||
volumes:
|
||||
- ./.ssh:/root/.ssh
|
||||
depends_on:
|
||||
- api
|
||||
|
||||
caddy:
|
||||
image: caddy:2-alpine
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
volumes:
|
||||
- ./Caddyfile:/etc/caddy/Caddyfile
|
||||
- caddy_data:/data
|
||||
- caddy_config:/config
|
||||
depends_on:
|
||||
- api
|
||||
|
||||
volumes:
|
||||
caddy_data:
|
||||
caddy_config:
|
||||
Reference in New Issue
Block a user