-
-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathDockerfile
More file actions
46 lines (36 loc) · 1.1 KB
/
Copy pathDockerfile
File metadata and controls
46 lines (36 loc) · 1.1 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
###############################
# for development
###############################
### pict ###
FROM golang:1.25-bookworm AS target_for_development
RUN apt update
RUN apt -y install clang
RUN which clang
WORKDIR /root
RUN git clone https://github.com/microsoft/pict.git
WORKDIR /root/pict
RUN make && install ./pict /usr/bin
RUN which pict
### golang ###
# install libraries
WORKDIR /root/api
COPY go.* ./
RUN go mod download
# to enable auto reloading while developing
RUN go install github.com/air-verse/air@latest
###############################
# for production
###############################
FROM target_for_development AS target_for_compilation
WORKDIR /root/api
COPY *.go ./
# GOARCHの指定をしないとCloud Runで動かない
RUN go build -v -o server
# Use clean image for a lean production container.
# https://docs.docker.com/develop/develop-images/multistage-build/#use-multi-stage-builds
FROM debian:bookworm-slim AS target_for_production
COPY --from=target_for_compilation /root/pict/pict /usr/bin/
RUN which pict
COPY --from=target_for_compilation /root/api/server /server
EXPOSE 8080
CMD ["/server"]