-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
34 lines (27 loc) · 827 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
# syntax = docker/dockerfile:1.4
# frontend
FROM node:19 as build-node
COPY . /build
WORKDIR /build
ENV NODE_ENV=production
RUN \
--mount=type=cache,target=/build/cmd/httpserver/public/node_modules \
make node-build
# backend
FROM golang:latest as build-go
COPY . /build
COPY --from=build-node /build/cmd/httpserver/public/dist/ /build/cmd/httpserver/public/dist/
WORKDIR /build
RUN \
--mount=type=cache,target=/root/.cache \
--mount=type=cache,target=/go \
make go-build
# runtime
FROM alpine:3.18
RUN apk add --no-cache ca-certificates
RUN if [ ! -e /etc/nsswitch.conf ];then echo 'hosts: files dns' > /etc/nsswitch.conf;fi
COPY --from=build-go /build/httpserver /app/httpserver
EXPOSE 8080
WORKDIR /app
ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
CMD ["/app/httpserver"]