-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
46 lines (32 loc) · 1002 Bytes
/
Dockerfile
File metadata and controls
46 lines (32 loc) · 1002 Bytes
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
# Stage 1: Build both Nuxt.js and Go application
FROM node:20-alpine AS builder
# Install pnpm and Go
RUN npm install -g pnpm && \
apk add --no-cache go git
# Set working directory
WORKDIR /app
# Copy package files
COPY package.json pnpm-lock.yaml ./
# Install dependencies
RUN pnpm install
# Copy the entire project
COPY . .
# Run the build:prod command from package.json
# This will generate the Nuxt app, copy it to pocketbase dir, and build the Go binary
RUN pnpm run build:prod
# Stage 3: Create the final minimal image
FROM alpine:3.18
# Create a user to run the app
RUN addgroup -S massolit && adduser -S massolit -G massolit
# Set working directory
WORKDIR /app
# Copy the binary from the builder stage
COPY --from=builder /app/massolit .
# Ensure correct permissions
# RUN chown -R massolit:massolit /app
# Use the non-root user
# USER massolit
# Expose the port the app runs on
EXPOSE 8090
# Command to run the application
CMD ["./massolit", "serve", "--http=0.0.0.0:8090"]