38 lines
925 B
Docker
Executable File
38 lines
925 B
Docker
Executable File
# [0] Go build environment
|
|
FROM golang:1.24.5-alpine3.21 AS builder
|
|
WORKDIR /web-server
|
|
|
|
## Dependencies
|
|
# Get
|
|
COPY ./src/main/go.mod ./src/main/go.sum ./src/
|
|
# Download
|
|
RUN cd ./src && \
|
|
go mod download
|
|
|
|
## Executable
|
|
# Get
|
|
COPY ./src/main/ ./src/
|
|
# Build
|
|
RUN cd ./src && \
|
|
go build -o ../build/web_server
|
|
|
|
# [1] Final image -> new FS
|
|
FROM alpine:latest
|
|
WORKDIR /root/
|
|
|
|
# Add certs for net communication
|
|
RUN apk add --no-cache ca-certificates
|
|
|
|
## Final build
|
|
# Get
|
|
COPY --from=builder /web-server/build ./build/
|
|
COPY ./src/layouts/components ./layouts/components
|
|
COPY ./src/layouts/pages ./layouts/pages
|
|
COPY ./src/layouts/static/styles/global.css ./layouts/static/styles/global.css
|
|
COPY ./src/layouts/static/styles/stylesheet.css ./layouts/static/styles/stylesheet.css
|
|
COPY ./src/layouts/static ./layouts/static
|
|
COPY ./.env ./config/.env
|
|
|
|
# Run
|
|
CMD ["./build/web_server"]
|