@@ -2,53 +2,35 @@ FROM golang:1.23.2 AS base
2
2
3
3
WORKDIR /build
4
4
5
- RUN case "$(uname -m)" in \
6
- "x86_64" ) ARCH="x64" ;; \
7
- "aarch64" ) ARCH="arm64" ;; \
8
- *) echo "Unsupported architecture: $(uname -m)" && exit 1 ;; \
9
- esac && \
10
- curl -sLO https://github.com/tailwindlabs/tailwindcss/releases/download/v3.4.15/tailwindcss-linux-${ARCH} && \
11
- chmod +x tailwindcss-linux-${ARCH} && \
12
- mv tailwindcss-linux-${ARCH} /usr/local/bin/tailwindcss
13
-
14
- RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.61.0
15
- RUN go install github.com/a-h/templ/cmd/
[email protected] && go install github.com/mitranim/gow@latest
16
-
17
- FROM base AS install
5
+ COPY scripts/install.sh .
6
+ RUN chmod +x install.sh && ./install.sh && go install github.com/a-h/templ/cmd/
[email protected]
7
+
8
+ FROM base AS build
18
9
COPY go.mod go.sum ./
19
10
RUN go mod download
20
11
COPY . .
21
12
RUN make generate && go vet ./...
22
13
RUN make css
23
- RUN make release
14
+ RUN make release && go build -o migrate cmd/migrate/main.go && go build -o seed_db cmd/seed/main.go
24
15
25
16
# Default final base image to Alpine Linux
26
17
FROM alpine:3.21 AS production
27
18
28
19
# Ensure we have latest packages applied
29
- RUN apk update \
30
- && apk upgrade
20
+ RUN apk update && apk upgrade
31
21
32
22
# Create a non-root user
33
23
RUN addgroup -g 10001 -S iota-user \
34
24
&& adduser --disabled-password --gecos '' -u 10000 --home /home/iota-user iota-user -G iota-user \
35
25
&& chown -R iota-user:iota-user /home/iota-user
36
26
37
27
WORKDIR /home/iota-user
38
- COPY --from=install /build/run_server ./run_server
28
+ COPY --from=build /build/run_server ./run_server
29
+ COPY --from=build /build/migrate ./migrate
30
+ COPY --from=build /build/seed_db ./seed_db
39
31
40
32
ENV PATH=/home/iota-user:$PATH
41
33
42
34
USER iota-user
43
- ENTRYPOINT run_server
44
-
45
- FROM install AS staging
46
- RUN go build -o run_server cmd/server/main.go && go build -o seed_db cmd/seed/main.go
47
- CMD go run cmd/migrate/main.go up && /build/seed_db && /build/run_server
48
-
49
- FROM install AS testing-ci
50
- # CMD golangci-lint run && go test -v ./...
51
- CMD [ "go" , "test" , "-v" , "./..." ]
35
+ CMD ["/bin/sh" , "-c" , "./migrate && ./seed_db && ./run_server" ]
52
36
53
- FROM install AS testing-local
54
- CMD [ "gow" , "test" , "./..." ]
0 commit comments