Skip to content

Commit

Permalink
Enable CGO, build and publish Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
karniv00l committed Nov 9, 2022
1 parent 73fc1c7 commit 322886c
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 19 deletions.
32 changes: 32 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Dependency directories (remove the comment below to include it)
# vendor/

# Go workspace file
go.work

# mac
.DS_Store

# pb_data and backups
/backup
/pb_data
/pb_data.zip
/pb_data.tar.gz

# build
cloud-backend
cloud-backend.exe
main
2 changes: 1 addition & 1 deletion .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ builds:
ldflags:
- -s -w -X github.com/hyper-tuner/cloud-backend.Version={{ .Version }}
env:
- CGO_ENABLED=0
- CGO_ENABLED=1
goos:
- linux
- windows
Expand Down
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM golang:1.19 AS builder

RUN mkdir /app
COPY . /app
WORKDIR /app

RUN CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -o cloud-backend

FROM alpine:latest AS production

COPY --from=builder /app .

EXPOSE 8090

CMD ["./cloud-backend", "serve", "--http=0.0.0.0:8090"]
20 changes: 14 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@ This is the backend for the [HyperTuner Cloud](https://github.com/hyper-tuner/hy
- deployment scripts / **Docker** and docker compose files
- migration scripts and guides

## Upgrading

Some versions will contain breaking changes.

If you are upgrading from a previous version, please read the [UPGRADE.md](UPGRADE.md) file.

## Setting up your instance

Use provider Docker files from the `/docker` directory or just grab the binary from the [Releases](https://github.com/hyper-tuner/cloud-backend/releases) page.
Expand All @@ -39,6 +33,20 @@ This will create `pb_data` directory where all the data will be stored (SQLite,

Now you can access the admin UI at: [https://your-instance.com/_/](https://your-instance.com/_/).

### Docker

https://hub.docker.com/r/karniv001/hyper-tuner-cloud-backend

```bash
docker pull karniv001/hyper-tuner-cloud-backend
```

## Upgrading

Some versions will contain breaking changes.

If you are upgrading from a previous version, please read the [UPGRADE.md](UPGRADE.md) file.

### Application name and URL

Located in admin UI: `Settings -> Application`.
Expand Down
6 changes: 2 additions & 4 deletions docker/docker-compose.yml → docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ version: '3.1'

services:
cloud-backend:
platform: linux/x86_64
build: .
image: karniv001/hyper-tuner-cloud-backend:latest
restart: unless-stopped
command: ["/cloud-backend", "serve", "--http=0.0.0.0:8080"]
volumes:
- ./pb_data:/pb_data
ports:
- 80:8080
- 80:8090
1 change: 0 additions & 1 deletion docker/.dockerignore

This file was deleted.

7 changes: 0 additions & 7 deletions docker/Dockerfile

This file was deleted.

0 comments on commit 322886c

Please sign in to comment.