Skip to content

Instantly share code, notes, and snippets.

@Formergg
Formergg / Dockerfile
Created March 11, 2021 04:26
标准输出日志示例代码
# Use the official golang image to create a build artifact
FROM golang:1.13 as builder
# Create app directory
RUN mkdir /app
# Add file to /app/
ADD . /app/
# Build the binary
WORKDIR /app
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main .
# Run service on container startup
@Formergg
Formergg / Dockerfile
Created March 11, 2021 04:23
打印日志文件示例代码
# Use the official golang image to create a build artifact
FROM golang:1.13 as builder
# Create app directory
RUN mkdir /app
# Add file to /app/
ADD . /app/
# Build the binary
@Formergg
Formergg / Dockerfile
Created February 22, 2021 09:02
Case 2:使用镜像,部署失败 - 逻辑问题查日志定位
# Use the official golang image to create a build artifact
FROM golang:1.13 as builder
# Create app directory
RUN mkdir /app
# Add file to /app/
ADD . /app/
# Build the binary
@Formergg
Formergg / Dockerfile
Created February 22, 2021 08:59
Case 1:使用代码构建,部署失败 - 服务无法正常拉起
# Use the official golang image to create a build artifact
FROM golang:1.13 as builder
# Create app directory
RUN mkdir /app
# Add file to /app/
ADD . /app/
# Build the binary
WORKDIR /app
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main .
# Run service on container startup