Skip to content

Instantly share code, notes, and snippets.

@siteslave
Created December 15, 2021 14:36
Show Gist options
  • Save siteslave/f5b05b3f5ea6ca77928720ce4439f958 to your computer and use it in GitHub Desktop.
Save siteslave/f5b05b3f5ea6ca77928720ce4439f958 to your computer and use it in GitHub Desktop.
Dockerfile for angular project
# Stage 0
FROM node:14-alpine3.12 as ngbuilder
LABEL maintainer="Satit Rianpit <[email protected]>"
WORKDIR /home/xxx
RUN apk add --upgrade --no-cache --virtual deps python3 build-base git
COPY . .
RUN npm i
RUN npm i -g @angular/cli
RUN npm run build
# Stage 1
FROM golang:alpine as builder
RUN apk update && apk add --no-cache git
RUN mkdir /build
ADD ./server /build/
WORKDIR /build
RUN go build -o server .
# Stage 2
FROM alpine
RUN adduser -S -D -H -h /app siteslave
USER siteslave
COPY --from=builder /build/ /app/
COPY --from=ngbuilder /home/xxx/dist/web/ /app/web/
WORKDIR /app
CMD ["./server"]
@siteslave
Copy link
Author

server.go

package main

import "github.com/gofiber/fiber/v2"

func main() {
	app := fiber.New()

	app.Static("/", "./web")
	app.Listen(":80")
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment