-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
51 lines (33 loc) · 949 Bytes
/
Dockerfile
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
# Stage 1: modules caching
FROM golang:1.21-alpine as modules
LABEL maintainer="[email protected]"
WORKDIR /awasm
COPY go.* .
RUN go mod download
# Stage 2: build
FROM golang:1.21-alpine as builder
LABEL maintainer="[email protected]"
ENV CGO_ENABLED 0
ENV GO111MODULE=on
COPY --from=modules /go/pkg /go/pkg
WORKDIR /awasm
COPY . .
RUN apk --no-cache add build-base git \
&& make clean build
RUN cp ./awasm /usr/bin/awasm && cp ./config/awasm.docker.yaml ./awasm.yaml
# Stage 3: deploy
FROM alpine:3 as runtime
LABEL maintainer="[email protected]"
WORKDIR /awasm
RUN apk update \
&& apk --no-cache add \
bash \
&& echo "UTC" > /etc/timezone
ARG TZ
ENV TZ=${TZ:-"UTC"}
COPY --from=builder /usr/bin/awasm /usr/bin/awasm
COPY --from=builder /awasm/i18n ./i18n
COPY --from=builder /awasm/awasm.yaml ./awasm.yaml
RUN chmod 755 /usr/bin/awasm
EXPOSE 8080
CMD ["awasm", "run", "--config-path", "/awasm/awasm.yaml"]