Skip to content

Commit 684c8b4

Browse files
authored
Update Golang Dockerfile (#118)
1 parent 1753188 commit 684c8b4

File tree

4 files changed

+67
-67
lines changed

4 files changed

+67
-67
lines changed

.github/workflows/build.yml

+23-23
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: CI
22

33
on:
44
pull_request:
5-
branches: [ main ]
5+
branches: [main]
66

77
jobs:
88
build:
@@ -14,25 +14,25 @@ jobs:
1414
working-directory: .
1515

1616
steps:
17-
- name: Check out code
18-
uses: actions/checkout@v3
19-
20-
- name: Set up Docker Context for Buildx
21-
id: buildx-context
22-
run: |
23-
docker context create builders
24-
25-
- name: Set up Docker Builder
26-
uses: docker/setup-buildx-action@v2
27-
with:
28-
version: latest
29-
install: true
30-
endpoint: builders
31-
32-
- name: Set up QEMU
33-
uses: docker/setup-qemu-action@v2
34-
with:
35-
platforms: arm64,amd64
36-
37-
- name: "Build"
38-
run: make build
17+
- name: Check out code
18+
uses: actions/checkout@v4
19+
20+
- name: Set up Docker Context for Buildx
21+
id: buildx-context
22+
run: |
23+
docker context create builders
24+
25+
- name: Set up Docker Builder
26+
uses: docker/setup-buildx-action@v3
27+
with:
28+
version: latest
29+
install: true
30+
endpoint: builders
31+
32+
- name: Set up QEMU
33+
uses: docker/setup-qemu-action@v3
34+
with:
35+
platforms: arm64,amd64
36+
37+
- name: "Build"
38+
run: make build

.github/workflows/push.yml

+28-28
Original file line numberDiff line numberDiff line change
@@ -15,31 +15,31 @@ jobs:
1515
working-directory: .
1616

1717
steps:
18-
- name: Check out code
19-
uses: actions/checkout@v3
20-
21-
- name: Set up Docker Context for Buildx
22-
id: buildx-context
23-
run: |
24-
docker context create builders
25-
26-
- name: Set up Docker Builder
27-
uses: docker/setup-buildx-action@v2
28-
with:
29-
version: latest
30-
install: true
31-
endpoint: builders
32-
33-
- name: Set up QEMU
34-
uses: docker/setup-qemu-action@v2
35-
with:
36-
platforms: arm64,amd64
37-
38-
- name: Login to DockerHub
39-
uses: docker/login-action@v2
40-
with:
41-
username: "${{ secrets.DOCKER_USER }}"
42-
password: "${{ secrets.DOCKER_PASS }}"
43-
44-
- name: "Push"
45-
run: make push
18+
- name: Check out code
19+
uses: actions/checkout@v4
20+
21+
- name: Set up Docker Context for Buildx
22+
id: buildx-context
23+
run: |
24+
docker context create builders
25+
26+
- name: Set up Docker Builder
27+
uses: docker/setup-buildx-action@v3
28+
with:
29+
version: latest
30+
install: true
31+
endpoint: builders
32+
33+
- name: Set up QEMU
34+
uses: docker/setup-qemu-action@v3
35+
with:
36+
platforms: arm64,amd64
37+
38+
- name: Login to DockerHub
39+
uses: docker/login-action@v3
40+
with:
41+
username: "${{ secrets.DOCKER_USER }}"
42+
password: "${{ secrets.DOCKER_PASS }}"
43+
44+
- name: "Push"
45+
run: make push

docker-compose.golang.yml

+9-12
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: '3.7'
1+
version: "3.7"
22

33
services:
44
golang1:
@@ -24,6 +24,10 @@ services:
2424
dockerfile: golang/Dockerfile
2525
args:
2626
VERSION: "1.22"
27+
# Need to override this because newever versions of gopls doesn't work with this golang version
28+
GOPLS_VERSION: "v0.16.1"
29+
# Need to override this because newever versions of AIR doesn't work with this golang version
30+
AIR_VERSION: "v1.52.3"
2731

2832
golang1.21:
2933
image: okteto/golang:1.21
@@ -34,14 +38,7 @@ services:
3438
VERSION: "1.21"
3539
# Need to override this because default value doesn't work with this golang version
3640
CONTROLLER_GEN_VERSION: "v0.14.0"
37-
38-
golang1.20:
39-
image: okteto/golang:1.20
40-
build:
41-
context: .
42-
dockerfile: golang/Dockerfile
43-
args:
44-
VERSION: "1.20"
45-
DEBIAN_VERSION: "buster"
46-
# Need to override this because default value doesn't work with this golang version
47-
CONTROLLER_GEN_VERSION: "v0.14.0"
41+
# Need to override this because newever versions of AIR doesn't work with this golang version
42+
AIR_VERSION: "v1.49.0"
43+
# Need to override this because newever versions of gopls doesn't work with this golang version
44+
GOPLS_VERSION: "v0.16.1"

golang/Dockerfile

+7-4
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,19 @@ ARG DEBIAN_VERSION="bookworm"
33
FROM golang:${VERSION}-${DEBIAN_VERSION}
44

55
ARG CONTROLLER_GEN_VERSION="v0.16.5"
6+
ARG DLV_VERSION="latest"
7+
ARG AIR_VERSION="v1.61.5"
8+
ARG GOPLS_VERSION="latest"
69

710
WORKDIR /usr/src/app
811

912
# setup okteto message
1013
COPY bashrc /root/.bashrc
1114

1215
RUN go install github.com/codegangsta/gin@latest && \
13-
go install github.com/go-delve/delve/cmd/dlv@latest && \
14-
go install golang.org/x/tools/gopls@latest && \
15-
go install sigs.k8s.io/controller-tools/cmd/controller-gen@${CONTROLLER_GEN_VERSION}
16-
RUN curl -sSfL https://raw.githubusercontent.com/air-verse/air/master/install.sh | sh -s -- -b /usr/bin
16+
go install github.com/go-delve/delve/cmd/dlv@${DLV_VERSION} && \
17+
go install golang.org/x/tools/gopls@${GOPLS_VERSION} && \
18+
go install sigs.k8s.io/controller-tools/cmd/controller-gen@${CONTROLLER_GEN_VERSION} && \
19+
curl -sSfL https://raw.githubusercontent.com/air-verse/air/master/install.sh | sh -s -- -b /usr/bin -d ${AIR_VERSION}
1720

1821
CMD ["bash"]

0 commit comments

Comments
 (0)