Skip to content

Commit

Permalink
Merge pull request #52 from hackroid/optimizeDockerfileByMGMCN
Browse files Browse the repository at this point in the history
optimize dockerfile to reduce docker image size...
  • Loading branch information
hackroid authored Apr 11, 2023
2 parents 70c2031 + 24e3162 commit d3e3c55
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/actions/docker/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ runs:
- name: build dockerfile
shell: bash
run: |
docker build . -t test
docker build . -t test
12 changes: 2 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.20.2-bullseye
FROM golang:1.20.2-alpine3.17

ENV token="123456789:ABCDEFGHIJKLMNOPQRSTUVWXYZ"
ENV debug="1"
Expand All @@ -9,14 +9,6 @@ COPY . /usr/local/go/src/BOT

WORKDIR /usr/local/go/src/BOT

RUN rm -rf bin && \
rm -rf .env && \
go get github.com/go-telegram-bot-api/telegram-bot-api/v5 && \
go get github.com/joho/godotenv && \
go get github.com/gocolly/colly/v2 && \
go mod tidy && \
go build -o bin/ ./app/main/ && \
touch .env && \
chmod +x run.sh
RUN chmod +x run.sh

CMD sh run.sh $token $debug
8 changes: 8 additions & 0 deletions run.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
#!/bin/sh
rm -rf bin
rm -rf .env
go get github.com/go-telegram-bot-api/telegram-bot-api/v5
go get github.com/joho/godotenv
go get github.com/gocolly/colly/v2
go mod tidy
go build -o bin/ ./app/main/
touch .env
echo "TELEGRAM_APITOKEN=$1" >> .env
echo "DEBUG=$2" >> .env
./bin/main

0 comments on commit d3e3c55

Please sign in to comment.