-
Notifications
You must be signed in to change notification settings - Fork 15
/
Dockerfile
47 lines (32 loc) · 992 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
FROM golang:1.21 as build
ARG VERSION
ARG GIT_COMMIT
ARG GOOS=linux
RUN mkdir /oscar
WORKDIR /oscar
COPY go.mod .
COPY go.sum .
COPY main.go .
COPY pkg pkg
RUN GOOS=${GOOS} CGO_ENABLED=0 go build --ldflags "-s -w \
-X \"github.com/grycap/oscar/v3/pkg/version.Version=${VERSION}\" \
-X \"github.com/grycap/oscar/v3/pkg/version.GitCommit=${GIT_COMMIT}\"" \
-a -installsuffix cgo -o oscar .
FROM alpine:3.14
LABEL org.label-schema.license="Apache 2.0" \
org.label-schema.vcs-url="https://github.com/grycap/oscar" \
org.label-schema.vcs-type="Git" \
org.label-schema.name="grycap/oscar" \
org.label-schema.vendor="grycap" \
org.label-schema.docker.schema-version="1.0"
RUN addgroup -S app \
&& adduser -S -g app app \
&& apk add --no-cache ca-certificates
WORKDIR /home/app
EXPOSE 8080
COPY --from=build /oscar/oscar .
# Remember to build the ui first (npm install && npm run build)
COPY /ui/dist assets
RUN chown -R app:app ./
USER app
CMD ["./oscar"]