-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Delete file/list.go, file/id_generator.go, and file/upload.go. Update go.mod. * Add downloadFile function to FilesRessources controller * Fix file saving bug and improve error handling * Refactor file package and move functions to utils package * Update Dockerfile and main.go --------- Co-authored-by: minpeter <[email protected]>
- Loading branch information
Showing
18 changed files
with
722 additions
and
726 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: BUILD and PUSH to GHR | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: ["main"] | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
REGISTRY_IMAGE: ghcr.io/${{ github.repository }} | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push with Buildx | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
platforms: linux/arm64, linux/amd64 | ||
push: true | ||
tags: ${{ env.REGISTRY_IMAGE }}:${{ github.head_ref }}, ${{ env.REGISTRY_IMAGE }}:${{ github.sha }} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=min |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,22 @@ | ||
# Step 1: Modules caching | ||
FROM golang:1.19.4-alpine as modules | ||
FROM --platform=$BUILDPLATFORM golang:1.19.4-alpine as modules | ||
COPY go.mod go.sum /modules/ | ||
WORKDIR /modules | ||
RUN go mod download | ||
|
||
# Step 2: Builder | ||
FROM golang:1.19.4-alpine AS builder | ||
FROM --platform=$BUILDPLATFORM golang:1.19.4-alpine AS builder | ||
COPY --from=modules /go/pkg /go/pkg | ||
COPY . /app | ||
ENV CGO_ENABLED=0 | ||
WORKDIR /app | ||
RUN go build -o /bin/app . | ||
ARG TARGETOS TARGETARCH | ||
ENV CGO_ENABLED=0 | ||
RUN GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o /app/server . | ||
|
||
# GOPATH for scratch images is / | ||
FROM scratch | ||
COPY --from=builder /bin/app /app | ||
WORKDIR /app | ||
COPY --from=builder /app/server /app/server | ||
EXPOSE 5000 | ||
CMD ["/app"] | ||
CMD ./server |
Oops, something went wrong.