Skip to content

Commit

Permalink
Improve Docker support
Browse files Browse the repository at this point in the history
  • Loading branch information
nexryai committed Jan 18, 2024
1 parent 6db66ef commit 2173905
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Build Docker image
on:
push:
branches:
- 'main'
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: nexryai/summaly-go:latest
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ WORKDIR /app

COPY . ./

RUN apk add --no-cache git ca-certificates build-base \
RUN sed -i 's#https\?://dl-cdn.alpinelinux.org/alpine#https://mirrors.xtom.com.hk/alpine#g' /etc/apk/repositories \
&& apk add --no-cache git ca-certificates build-base \
&& go build -ldflags="-s -w" -trimpath -o summaly main.go

FROM alpine:3.12
Expand All @@ -13,7 +14,8 @@ WORKDIR /app

COPY --from=builder /app/summaly /app/summaly

RUN apk add --no-cache ca-certificates tini \
RUN sed -i 's#https\?://dl-cdn.alpinelinux.org/alpine#https://mirrors.xtom.com.hk/alpine#g' /etc/apk/repositories \
&& apk add --no-cache ca-certificates tini \
&& addgroup -g 749 app \
&& adduser -u 749 -G app -D -h /app app \
&& chmod +x /app/summaly \
Expand Down

0 comments on commit 2173905

Please sign in to comment.