Fix release pipeline and upgrade Dockerfile

This commit is contained in:
ErickSkrauch 2023-12-12 02:06:00 +01:00
parent 6accffed45
commit ecbb06b83c
No known key found for this signature in database
GPG Key ID: 669339FCBB30EE0E
2 changed files with 25 additions and 9 deletions

View File

@ -26,17 +26,21 @@ jobs:
type=semver,pattern={{major}}.{{minor}} type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}} type=semver,pattern={{major}}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3 uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry - name: Log in to the Container registry
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:
username: ${{ secrets.DOCKERHUB_USERNAME }} username: ${{ env.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }} password: ${{ env.DOCKERHUB_TOKEN }}
- name: Build and Push - name: Build and Push
uses: docker/build-push-action@v5 uses: docker/build-push-action@v5
with: with:
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64

View File

@ -1,14 +1,26 @@
FROM alpine:3.9.3 # syntax=docker/dockerfile:1
FROM golang:1.21-alpine AS builder
COPY . /build
WORKDIR /build
RUN go mod download
RUN CGO_ENABLED=0 \
go build \
-trimpath \
-ldflags="-w -s" \
-o chrly \
main.go
FROM alpine:3.19
EXPOSE 80 EXPOSE 80
RUN apk add --no-cache ca-certificates
ENV STORAGE_REDIS_HOST=redis ENV STORAGE_REDIS_HOST=redis
ENV STORAGE_FILESYSTEM_HOST=/data ENV STORAGE_FILESYSTEM_HOST=/data
COPY docker-entrypoint.sh /usr/local/bin/ COPY docker-entrypoint.sh /
COPY release/chrly /usr/local/bin/ COPY --from=builder /build/chrly /usr/local/bin/chrly
ENTRYPOINT ["docker-entrypoint.sh"] ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["serve"] CMD ["serve"]