-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
58 lines (35 loc) · 1.53 KB
/
Dockerfile
File metadata and controls
58 lines (35 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
ARG IMAGE_TAG
FROM golang:1.22.2 AS builder
WORKDIR /tmp/app
ARG IMAGE_TAG
COPY ./go.mod ./go.sum ./
RUN --mount=type=cache,target=/go/pkg/mod/ go mod download -x
COPY . .
RUN --mount=type=cache,target=/go/pkg/mod/ \
--mount=type=cache,target=/root/.cache \
CGO_ENABLED=0 GOOS=linux go build -C . -ldflags "-X 'github.com/abramad-labs/irbankmock/internal/version.ServerVersion=${IMAGE_TAG:-development}'" -o dist/build ./cmd/server/main.go
FROM oven/bun:1.2.4 AS frontbuilder
ENV BUN_INSTALL_CACHE_DIR=/usr/.bun/install/cache
WORKDIR /app
COPY web/app/bun.lock web/app/package.json ./
RUN --mount=type=cache,target=/app/.next/cache \
--mount=type=cache,target=/root/.cache \
--mount=type=cache,target=${BUN_INSTALL_CACHE_DIR} \
bun install --frozen-lockfile
COPY web/app .
RUN --mount=type=cache,target=/app/.next/cache \
--mount=type=cache,target=${BUN_INSTALL_CACHE_DIR} \
bun run build
#FROM alpine:3.22 # if you want more debug tools
FROM gcr.io/distroless/static-debian12:nonroot
WORKDIR /opt/irbankmock/data
WORKDIR /opt/irbankmock/web/app
COPY --from=frontbuilder /app/out ./
WORKDIR /etc/abramad/irbankmock
COPY --from=builder /tmp/app/dist/build ./server
ENV IRBANKMOCK_DATA_PATH=/opt/irbankmock/data
ENV IRBANKMOCK_WEBAPP_PATH=/opt/irbankmock/web/app
LABEL org.opencontainers.image.source=https://github.com/abramad-labs/irbankmock
LABEL org.opencontainers.image.description="service for testing the internet payment gateways of Iranian banks"
LABEL org.opencontainers.image.licenses=MIT
CMD ["./server"]