Skip to content

Commit

Permalink
Openapi with fuego (#34)
Browse files Browse the repository at this point in the history
* 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
minpeter and minpeter authored Mar 22, 2024
1 parent f90e15f commit cdf4b7a
Show file tree
Hide file tree
Showing 18 changed files with 722 additions and 726 deletions.
37 changes: 0 additions & 37 deletions .github/workflows/dev.yaml

This file was deleted.

46 changes: 46 additions & 0 deletions .github/workflows/ghr-image-bp.yml
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
37 changes: 0 additions & 37 deletions .github/workflows/production.yaml

This file was deleted.

13 changes: 8 additions & 5 deletions Dockerfile
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
Loading

0 comments on commit cdf4b7a

Please sign in to comment.