ci: update docker file

This commit is contained in:
log101 2024-06-02 11:44:39 +03:00
parent f346241e5c
commit 78aa85dc20
3 changed files with 8 additions and 21 deletions

View File

@ -1,18 +0,0 @@
run-name: ${{ gitea.actor }}, deploy with ssh
on: [push]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Rebuild docker compose
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
script: |
cd /home/log101/prod/log101.dev-services
git pull
docker compose up -d --build

View File

@ -1,4 +1,4 @@
FROM golang:1.22.3
FROM golang:1.22.3-alpine as builder
WORKDIR /usr/src/app
@ -7,6 +7,10 @@ COPY go.mod go.sum ./
RUN go mod download && go mod verify
COPY . .
RUN go build -v -o /usr/local/bin ./...
RUN go build -v -o log101-dot-dev-services
CMD ["log101-blog-services"]
FROM alpine
WORKDIR /root/app
COPY --from=builder /usr/src/app .
CMD ["./log101-dot-dev-services"]

View File

@ -68,6 +68,7 @@ func countEmojis(postId string) ([]EmojiCount, error) {
}
func main() {
// Load environment variables
err := godotenv.Load()
if err != nil {
log.Fatal("Error loading .env file")