diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index f448efe..0898bfd 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -30,6 +30,9 @@ jobs: with: toolchain: nightly profile: minimal + - uses: actions/setup-go@v5 + with: + go-version: '^1.23.1' - name: Install Moon uses: 'moonrepo/setup-toolchain@v0' - run: 'moon run :docker-build' diff --git a/.moon/workspace.yml b/.moon/workspace.yml index 1f55e35..1e71605 100644 --- a/.moon/workspace.yml +++ b/.moon/workspace.yml @@ -3,6 +3,7 @@ $schema: 'https://moonrepo.dev/schemas/workspace.json' projects: client: 'apps/wopper' server: 'apps/mule' + s3proxy: 'apps/estrois' vcs: manager: 'git' defaultBranch: 'main' diff --git a/apps/estrois/.dockerignore b/apps/estrois/.dockerignore new file mode 100644 index 0000000..9e03c48 --- /dev/null +++ b/apps/estrois/.dockerignore @@ -0,0 +1,32 @@ +# Include any files or directories that you don't want to be copied to your +# container here (e.g., local build artifacts, temporary files, etc.). +# +# For more help, visit the .dockerignore file reference guide at +# https://docs.docker.com/go/build-context-dockerignore/ + +**/.DS_Store +**/.classpath +**/.dockerignore +**/.env +**/.git +**/.gitignore +**/.project +**/.settings +**/.toolstarget +**/.vs +**/.vscode +**/*.*proj.user +**/*.dbmdl +**/*.jfm +**/bin +**/charts +**/docker-compose* +**/compose.y*ml +**/Dockerfile* +**/node_modules +**/npm-debug.log +**/obj +**/secrets.dev.yaml +**/values.dev.yaml +LICENSE +README.md diff --git a/apps/estrois/Dockerfile b/apps/estrois/Dockerfile new file mode 100644 index 0000000..3022cfc --- /dev/null +++ b/apps/estrois/Dockerfile @@ -0,0 +1,33 @@ +ARG GO_VERSION=1.23.3 +FROM --platform=$BUILDPLATFORM golang:${GO_VERSION} AS build +WORKDIR /src +RUN --mount=type=cache,target=/go/pkg/mod/ \ + --mount=type=bind,source=go.sum,target=go.sum \ + --mount=type=bind,source=go.mod,target=go.mod \ + go mod download -x +ARG TARGETARCH +RUN --mount=type=cache,target=/go/pkg/mod/ \ + --mount=type=bind,target=. \ + CGO_ENABLED=0 GOARCH=$TARGETARCH go build -o /bin/server . + +FROM alpine:3.20.3 AS final + +RUN --mount=type=cache,target=/var/cache/apk \ + apk --update add \ + ca-certificates \ + tzdata \ + && \ + update-ca-certificates +ARG UID=10001 +RUN adduser \ + --disabled-password \ + --gecos "" \ + --home "/nonexistent" \ + --shell "/sbin/nologin" \ + --no-create-home \ + --uid "${UID}" \ + appuser +USER appuser +COPY --from=build /bin/server /bin/ +EXPOSE 8080 +ENTRYPOINT [ "/bin/server" ] diff --git a/apps/estrois/compose.yaml b/apps/estrois/compose.yaml new file mode 100644 index 0000000..c677b25 --- /dev/null +++ b/apps/estrois/compose.yaml @@ -0,0 +1,13 @@ +services: + server: + build: + context: . + target: final + x-bake: + tags: + - "muandane/estrois:${tag}" + platforms: + - linux/amd64 + - linux/arm64 + ports: + - 8080:8080 \ No newline at end of file diff --git a/apps/estrois/moon.yml b/apps/estrois/moon.yml new file mode 100644 index 0000000..4412775 --- /dev/null +++ b/apps/estrois/moon.yml @@ -0,0 +1,34 @@ +type: 'tool' +language: 'golang' + +project: + name: 'estrois' + description: 'A smoll s3 proxy server.' + channel: '#estrois' + owner: 'infra.platform' + maintainers: ['zine.moualhi'] + +tasks: + dev: + command: 'go run main.go' + inputs: + - './*' + check: + command: 'go fmt ./... && go vet ./...' + options: + runInCI: true + build: + command: 'go build -o estrois' + inputs: + - './*' + outputs: + - './estrois' + options: + runInCI: true + docker-build: + command: 'docker buildx bake --push' + # deps: + # - 'check' + options: + runInCI: true +