Skip to content

Commit c4f186c

Browse files
authored
feat: Refactor Dockerfile and Makefile, and add goreleaser configuration (#3)
1 parent 60e2181 commit c4f186c

File tree

3 files changed

+34
-13
lines changed

3 files changed

+34
-13
lines changed

.goreleaser.yml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# This is an example goreleaser.yaml file with some sane defaults.
2+
# Make sure to check the documentation at http://goreleaser.com
3+
before:
4+
hooks:
5+
- go mod download
6+
builds:
7+
- env:
8+
- CGO_ENABLED=0
9+
main: cmd/main.go
10+
goos:
11+
- windows
12+
- darwin
13+
- linux
14+
goarch:
15+
- amd64
16+
- arm64
17+
ldflags: -s -w
18+
release:
19+
prerelease: auto
20+
checksum:
21+
name_template: "checksums.txt"
22+
snapshot:
23+
name_template: "{{ .Tag }}-next"
24+
changelog:
25+
sort: asc
26+
filters:
27+
exclude:
28+
- "^docs:"
29+
- "^test:"

Dockerfile

+3-11
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,10 @@ FROM golang:1.22 AS builder
33
ADD . /app
44
WORKDIR /app
55

6-
RUN make clean && make && mv mirage-ecs /stash/
7-
RUN cp -a html /stash/
8-
RUN cp docker/example-config.yml /stash/
6+
RUN make feature-proxy
97

108
FROM debian:bookworm-slim
119

1210
RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/*
13-
RUN mkdir -p /opt/mirage/html
14-
COPY --from=builder /stash/mirage-ecs /opt/mirage/
15-
COPY --from=builder /stash/example-config.yml /opt/mirage/
16-
COPY --from=builder /stash/html/* /opt/mirage/html/
17-
WORKDIR /opt/mirage
18-
ENV MIRAGE_LOG_LEVEL info
19-
ENV MIRAGE_CONF ""
20-
RUN /opt/mirage/mirage-ecs -version
11+
WORKDIR /opt/feature-proxy
12+
COPY --from=builder /app/feature-proxy /opt/feature-proxy/

Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
GIT_VER := $(shell git describe --tags)
22
DATE := $(shell date +%Y-%m-%dT%H:%M:%S%z)
33

4-
feature-proxy: *.go cmd/*.go go.mod go.sum
5-
CGO_ENABLED=0 go build -ldflags "-X main.Version=$(GIT_VER) -X main.buildDate=$(DATE)" -o feature-proxy ./cmd/main.go
4+
feature-proxy: cmd/*.go go.mod go.sum
5+
CGO_ENABLED=0 go build -o feature-proxy ./cmd/main.go
66

77
clean:
88
rm -rf dist/* feature-proxy

0 commit comments

Comments
 (0)