You've already forked hastebin-ansi
mirror of
https://github.com/armbian/hastebin-ansi.git
synced 2026-01-06 12:30:55 -08:00
infra: add support for docker
This commit is contained in:
committed by
M. Efe Çetin
parent
94b2c702ce
commit
5a2a3e95ea
25
Dockerfile
Normal file
25
Dockerfile
Normal file
@@ -0,0 +1,25 @@
|
||||
FROM golang:1.24-alpine AS builder
|
||||
|
||||
WORKDIR /src
|
||||
|
||||
# Copy go mod and project files
|
||||
COPY go.* ./
|
||||
RUN go mod download
|
||||
COPY . .
|
||||
|
||||
# Install necessary dependencies
|
||||
RUN apk update && apk add --no-cache git ca-certificates openssl && update-ca-certificates
|
||||
|
||||
# Build the binary
|
||||
RUN CGO_ENABLED=0 go build -ldflags "-s -w" -o ./hastebin ./cmd/main.go
|
||||
|
||||
FROM gcr.io/distroless/static:nonroot
|
||||
COPY --from=builder /etc/ssl/certs /etc/ssl/certs
|
||||
|
||||
# Copy the binary from the builder stage
|
||||
COPY --from=builder /src/hastebin /bin/hastebin
|
||||
|
||||
# Set the user and group
|
||||
USER 0:0
|
||||
|
||||
CMD ["/bin/hastebin", "--config", "/app/config.yaml"]
|
||||
@@ -13,7 +13,7 @@ storage:
|
||||
|
||||
documents:
|
||||
- key: "about"
|
||||
path: "./about.md"
|
||||
path: "/app/about.md"
|
||||
|
||||
rate_limiting:
|
||||
enable: true
|
||||
|
||||
@@ -3,10 +3,11 @@ services:
|
||||
haste-server:
|
||||
build: .
|
||||
environment:
|
||||
- STORAGE_TYPE=memcached
|
||||
- STORAGE_HOST=memcached
|
||||
- STORAGE_PORT=11211
|
||||
- STORAGE_TYPE=file
|
||||
- STORAGE_FILE_PATH=/app/pastes
|
||||
ports:
|
||||
- "7777:7777"
|
||||
memcached:
|
||||
image: memcached:latest
|
||||
volumes:
|
||||
- ./config.yaml:/app/config.yaml
|
||||
- ./about.md:/app/about.md
|
||||
- "./data:/app/pastes"
|
||||
|
||||
Reference in New Issue
Block a user