Skip to content

chore: update to golang:1.23.4/alpine:3.21 #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
**然后**,执行下面的命令或者项目中的程序(`bash pull-images.sh`),获取必要的镜像文件:

```bash
docker pull soulteary/golang-playground:web-1.19.0
docker pull soulteary/golang-playground:sandbox-1.19.0
docker pull soulteary/golang-playground:actuator-1.19.0
docker pull soulteary/golang-playground:web-1.23.4
docker pull soulteary/golang-playground:sandbox-1.23.4
docker pull soulteary/golang-playground:actuator-1.23.4
docker pull memcached:1.6.15-alpine
```

Expand All @@ -37,22 +37,22 @@ docker pull memcached:1.6.15-alpine
```bash
# bash make-images.sh
Sending build context to Docker daemon 1.349MB
Step 1/30 : ARG GO_VERSION=1.19.0
Step 2/30 : FROM golang:${GO_VERSION}-alpine3.16 AS build-playground
Step 1/30 : ARG GO_VERSION=1.23.4
Step 2/30 : FROM golang:${GO_VERSION}-alpine3.21 AS build-playground
---> 5e999c13ceac
Step 3/30 : LABEL maintainer="soulteary@gmail.com"
---> Using cache
---> a253b22ef53a
...
Successfully built 37e124ce9e7f
Successfully tagged soulteary/golang-playground:web-1.19.0
Successfully tagged soulteary/golang-playground:web-1.23.4
...
Successfully built 6017738b85ce
Successfully tagged soulteary/golang-playground:sandbox-1.19.0
Step 1/24 : ARG GO_VERSION=1.19.0
Step 2/24 : FROM golang:${GO_VERSION}-alpine3.16 AS build-sandbox
Successfully tagged soulteary/golang-playground:sandbox-1.23.4
Step 1/24 : ARG GO_VERSION=1.23.4
Step 2/24 : FROM golang:${GO_VERSION}-alpine3.21 AS build-sandbox
...
Successfully built c51b8a6647fb
Successfully tagged soulteary/golang-playground:actuator-1.19.0
Successfully tagged soulteary/golang-playground:actuator-1.23.4
```

6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ version: '3'
services:

sandbox:
image: soulteary/golang-playground:sandbox-1.19.0
image: soulteary/golang-playground:sandbox-1.23.4
restart: always
command: -mode=server -listen=0.0.0.0:80 -workers=1 -untrusted-container=soulteary/golang-playground:actuator-1.19.0
command: -mode=server -listen=0.0.0.0:80 -workers=1 -untrusted-container=soulteary/golang-playground:actuator-1.23.4
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
networks:
Expand All @@ -13,7 +13,7 @@ services:
- memcached

web:
image: soulteary/golang-playground:web-1.19.0
image: soulteary/golang-playground:web-1.23.4
restart: always
environment:
- SANDBOX_BACKEND_URL=http://sandbox:/run
Expand Down
10 changes: 5 additions & 5 deletions docker/Dockerfile.actuator
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG GO_VERSION=1.19.0
FROM golang:${GO_VERSION}-alpine3.16 AS build-sandbox
ARG GO_VERSION=1.23.4
FROM golang:${GO_VERSION}-alpine3.21 AS build-sandbox
# base deps
RUN apk update && apk add tzdata
# download golang deps
Expand All @@ -16,11 +16,11 @@ RUN CGO_ENABLED=0 go build -ldflags "-w -s" .



FROM alpine:3.16 AS build-actuator
FROM alpine:3.21 AS build-actuator
LABEL maintainer="soulteary@gmail.com"
RUN echo '' > /etc/apk/repositories && \
echo "https://mirror.tuna.tsinghua.edu.cn/alpine/v3.16/main" >> /etc/apk/repositories && \
echo "https://mirror.tuna.tsinghua.edu.cn/alpine/v3.16/community" >> /etc/apk/repositories && \
echo "https://mirror.tuna.tsinghua.edu.cn/alpine/v3.21/main" >> /etc/apk/repositories && \
echo "https://mirror.tuna.tsinghua.edu.cn/alpine/v3.21/community" >> /etc/apk/repositories && \
echo "Asia/Shanghai" > /etc/timezone
RUN apk add --no-cache docker-cli
COPY --from=build-sandbox /go/src/playground/sandbox/sandbox /bin/play-sandbox
Expand Down
10 changes: 5 additions & 5 deletions docker/Dockerfile.sandbox
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG GO_VERSION=1.19.0
FROM golang:${GO_VERSION}-alpine3.16 AS build-sandbox
ARG GO_VERSION=1.23.4
FROM golang:${GO_VERSION}-alpine3.21 AS build-sandbox
# base deps
RUN apk update && apk add tzdata
# download golang deps
Expand All @@ -16,11 +16,11 @@ RUN CGO_ENABLED=0 go build -ldflags "-w -s" .



FROM alpine:3.16
FROM alpine:3.21
LABEL maintainer="soulteary@gmail.com"
RUN echo '' > /etc/apk/repositories && \
echo "https://mirror.tuna.tsinghua.edu.cn/alpine/v3.16/main" >> /etc/apk/repositories && \
echo "https://mirror.tuna.tsinghua.edu.cn/alpine/v3.16/community" >> /etc/apk/repositories && \
echo "https://mirror.tuna.tsinghua.edu.cn/alpine/v3.21/main" >> /etc/apk/repositories && \
echo "https://mirror.tuna.tsinghua.edu.cn/alpine/v3.21/community" >> /etc/apk/repositories && \
echo "Asia/Shanghai" > /etc/timezone
RUN apk add --no-cache docker-cli
COPY --from=build-sandbox /go/src/playground/sandbox/sandbox /bin/play-sandbox
Expand Down
6 changes: 3 additions & 3 deletions docker/Dockerfile.web
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG GO_VERSION=1.19.0
FROM golang:${GO_VERSION}-alpine3.16 AS build-playground
ARG GO_VERSION=1.23.4
FROM golang:${GO_VERSION}-alpine3.21 AS build-playground
LABEL maintainer="soulteary@gmail.com"
# download golang deps
ENV GO111MODULE=on
Expand All @@ -14,7 +14,7 @@ RUN CGO_ENABLED=0 go build -ldflags "-w -s" .



FROM golang:${GO_VERSION}-alpine3.16
FROM golang:${GO_VERSION}-alpine3.21
COPY --from=build-playground /usr/local/go /usr/local/go-faketime

ENV CGO_ENABLED 0
Expand Down
6 changes: 3 additions & 3 deletions make-images.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash

docker build -t soulteary/golang-playground:web-1.19.0 -f docker/Dockerfile.web .
docker build -t soulteary/golang-playground:sandbox-1.19.0 -f docker/Dockerfile.sandbox .
docker build -t soulteary/golang-playground:actuator-1.19.0 -f docker/Dockerfile.actuator .
docker build -t soulteary/golang-playground:web-1.23.4 -f docker/Dockerfile.web .
docker build -t soulteary/golang-playground:sandbox-1.23.4 -f docker/Dockerfile.sandbox .
docker build -t soulteary/golang-playground:actuator-1.23.4 -f docker/Dockerfile.actuator .
6 changes: 3 additions & 3 deletions pull-images.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

docker pull soulteary/golang-playground:web-1.19.0
docker pull soulteary/golang-playground:sandbox-1.19.0
docker pull soulteary/golang-playground:actuator-1.19.0
docker pull soulteary/golang-playground:web-1.23.4
docker pull soulteary/golang-playground:sandbox-1.23.4
docker pull soulteary/golang-playground:actuator-1.23.4
docker pull memcached:1.6.15-alpine
6 changes: 3 additions & 3 deletions src/sandbox/sandbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,9 @@ type dockerContainer struct {
// ID is the docker container ID.
ID string `json:"ID"`
// Image is the docker image name.
Image string `json:"Image"`
Image string `json:"IMAGE"`
// Names is the docker container name.
Names string `json:"Names"`
Names string `json:"NAMES"`
}

// countDockerContainers records the metric for the current number of docker containers.
Expand All @@ -186,7 +186,7 @@ func countDockerContainers(ctx context.Context) {
// listDockerContainers returns the current running play_run containers reported by docker.
func listDockerContainers(ctx context.Context) ([]dockerContainer, error) {
out := new(bytes.Buffer)
cmd := exec.Command("docker", "ps", "--quiet", "--filter", "name=play_run_", "--format", "{{json .}}")
cmd := exec.Command("docker", "ps", "--filter", "name=play_run_", "--format", "json")
cmd.Stdout, cmd.Stderr = out, out
if err := cmd.Start(); err != nil {
return nil, fmt.Errorf("listDockerContainers: cmd.Start() failed: %w", err)
Expand Down