Skip to content

Commit 3e7bc86

Browse files
authored
Merge pull request #56 from Gearbox-protocol/update_docker
build: different docker images
2 parents 167698e + 2de1005 commit 3e7bc86

File tree

7 files changed

+58
-5
lines changed

7 files changed

+58
-5
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
- name: Set up Go
2929
uses: actions/setup-go@v3
3030
with:
31-
go-version: "1.17"
31+
go-version-file: "go.mod"
3232
cache: true
3333

3434
- name: Run GoReleaser

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ __debug_bin
44
main
55
app
66
/.env.local
7+
temp
8+
dist

.goreleaser.yaml

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,34 @@ changelog:
3434
- "^test:"
3535
- "^[Mm]erge"
3636
dockers:
37-
- goos: linux
37+
# Production image without shell
38+
- id: production
39+
goos: linux
3840
goarch: amd64
39-
41+
dockerfile: docker/Dockerfile.production
4042
image_templates:
4143
- "ghcr.io/{{ tolower .Env.REPO_NAME }}:latest"
4244
- "ghcr.io/{{ tolower .Env.REPO_NAME }}:{{ .Version }}"
43-
- "ghcr.io/{{ tolower .Env.REPO_NAME }}:{{ .Major }}"
45+
46+
# Debug image which we can ssh into
47+
- id: debug
48+
goos: linux
49+
goarch: amd64
50+
dockerfile: docker/Dockerfile.debug
51+
image_templates:
52+
- "ghcr.io/{{ tolower .Env.REPO_NAME }}:debug"
53+
- "ghcr.io/{{ tolower .Env.REPO_NAME }}:{{ .Version }}-debug"
54+
55+
# Image to run migrations from
56+
- id: migrate
57+
goos: linux
58+
goarch: amd64
59+
dockerfile: docker/Dockerfile.migrate
60+
image_templates:
61+
- "ghcr.io/{{ tolower .Env.REPO_NAME }}:migrate"
62+
- "ghcr.io/{{ tolower .Env.REPO_NAME }}:{{ .Version }}-migrate"
63+
extra_files:
64+
# migrations folder from github
65+
- "migrations"
66+
# Custom migrate script
67+
- "docker/3eye-migrate.sh"

docker/3eye-migrate.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
/migrate -path /migrations -database "$DATABASE_URL" "$@" up

docker/Dockerfile.debug

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM debian:11-slim
2+
3+
RUN apt-get update \
4+
&& apt-get install -y curl ca-certificates \
5+
&& update-ca-certificates
6+
7+
COPY 3eye /
8+
9+
ENTRYPOINT ["/3eye"]

docker/Dockerfile.migrate

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM debian:11-slim
2+
3+
ARG MIGRATE_VERSION=4.15.2
4+
ARG MIGRATE_PLATFORM=linux-amd64
5+
6+
RUN apt-get update \
7+
&& apt-get install -y curl
8+
9+
RUN curl -L "https://github.com/golang-migrate/migrate/releases/download/v${MIGRATE_VERSION}/migrate.${MIGRATE_PLATFORM}.tar.gz" | tar -xvz --directory / migrate
10+
11+
COPY migrations /migrations
12+
COPY docker/3eye-migrate.sh /
13+
14+
ENTRYPOINT ["/3eye-migrate.sh"]
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
FROM gcr.io/distroless/base-debian11
22

3-
ENTRYPOINT ["/3eye"]
43
COPY 3eye /
4+
5+
ENTRYPOINT ["/3eye"]

0 commit comments

Comments
 (0)