Skip to content

Commit

Permalink
add new debug alpine image
Browse files Browse the repository at this point in the history
  • Loading branch information
Divkix committed Jul 29, 2024
1 parent f76ce81 commit 98c0eff
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 5 deletions.
13 changes: 9 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
.PHONY: run tidy vendor build

GO_CMD = go
GORELEASER_CMD = goreleaser

run:
go run main.go
$(GO_CMD) run main.go

tidy:
go mod tidy
$(GO_CMD) mod tidy

vendor:
go mod vendor
$(GO_CMD) mod vendor

build:
goreleaser release --snapshot --skip=publish --clean --skip=sign
$(GORELEASER_CMD) release --snapshot --skip=publish --clean --skip=sign
27 changes: 27 additions & 0 deletions debug.docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# This is to run the alita-robot in debug mode with alpine image
# This starts up fast and does not do any optimizations
services:
alita:
build:
context: .
dockerfile: docker/debug.alpine
container_name: alita-robot
restart: always
env_file:
- .env
depends_on:
- mongodb
- redis

mongodb:
image: mongo:latest
restart: always
env_file:
- .db.env
volumes:
- ./docker/entrypoint-initdb.d/mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js:ro

redis:
image: redis:latest
restart: always
command: redis-server --requirepass redisPassword
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# This is to run the alita-robot in production mode with alpine image
# This does optimizations and builds slower
services:
alita:
build:
Expand Down
1 change: 1 addition & 0 deletions docker/alpine
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ FROM alpine
COPY --from=builder /app/out/alita_robot /app/alita_robot
ENTRYPOINT ["/app/alita_robot"]

# Metadata
LABEL org.opencontainers.image.authors="Divanshu Chauhan <divkix@divkix.me>"
LABEL org.opencontainers.image.url="https://divkix.me"
LABEL org.opencontainers.image.source="https://github.com/divideprojects/Alita_Robot"
Expand Down
16 changes: 16 additions & 0 deletions docker/alpine.debug
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Build Stage: Build bot using the alpine image
# This is an debug image, it will not compress the binary
FROM golang:alpine AS builder
RUN apk add --no-cache curl wget gnupg git upx
WORKDIR /app
COPY . .
RUN go build -o out/alita_robot
ENTRYPOINT ["/app/out/alita_robot"]

# Metadata
LABEL org.opencontainers.image.authors="Divanshu Chauhan <divkix@divkix.me>"
LABEL org.opencontainers.image.url="https://divkix.me"
LABEL org.opencontainers.image.source="https://github.com/divideprojects/Alita_Robot"
LABEL org.opencontainers.image.title="Alita Go Robot"
LABEL org.opencontainers.image.description="Official Alita Go Robot Debug Docker Image"
LABEL org.opencontainers.image.vendor="Divkix"
4 changes: 3 additions & 1 deletion docker/entrypoint-initdb.d/mongo-init.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// Switch to the 'alita' database
// this is the database that we want to create the user in and store files in
db = db.getSiblingDB('alita');

// create a new user
// create a new basic user with readWrite role on the 'alita' database
// the user is 'admin' with password 'admin'
db.createUser({
user: "admin",
pwd: "admin",
Expand Down
1 change: 1 addition & 0 deletions docker/goreleaser
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ FROM alpine
COPY alita_robot /
ENTRYPOINT ["/alita_robot"]

# Metadata
LABEL org.opencontainers.image.authors="Divanshu Chauhan <divkix@divkix.me>"
LABEL org.opencontainers.image.url="https://divkix.me"
LABEL org.opencontainers.image.source="https://github.com/divideprojects/Alita_Robot"
Expand Down

0 comments on commit 98c0eff

Please sign in to comment.