-
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathDockerfile
More file actions
48 lines (34 loc) · 1.11 KB
/
Dockerfile
File metadata and controls
48 lines (34 loc) · 1.11 KB
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
48
# Stage 1 - Build the Go application
FROM ghcr.io/trueforge-org/golang:1.25.1@sha256:b45268d9e708d20793c55803d550b9fc64ecfc000b82ea043712076d913af089 AS builder
USER root
# Install necessary build dependencies
RUN set -eux; \
apt-get update; \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
build-essential \
gcc \
git \
; \
rm -rf /var/lib/apt/lists/*
# Copy Go project files
COPY . /
# Create necessary directories
RUN mkdir -p /build /output && ls -la /build
# Set the working directory
WORKDIR /build
# Download Go dependencies
RUN go mod download
# Build the Go application
RUN go build -ldflags "-w -s" -o /output/my-proxy-service .
# Stage 2 - Create the final image
FROM ghcr.io/trueforge-org/ubuntu:24.4.0@sha256:f4f97014103ddd97cb710e71b9c6df79d4537dd0ce53d56c175fadd4c28139eb
# Set working directory
WORKDIR /app
# Copy the binary from the builder stage
COPY --from=builder /output/my-proxy-service .
# Set environment variables
ENV PORT=3000
# Expose the port
EXPOSE $PORT
# Set default command to run the binary
CMD ["./my-proxy-service"]