-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
54 lines (36 loc) · 1.09 KB
/
Copy pathDockerfile
File metadata and controls
54 lines (36 loc) · 1.09 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
49
50
51
52
53
FROM golang:1.23.7-alpine AS builder
# Set working directory
WORKDIR /app
# Install necessary build tools
RUN apk add --no-cache git build-base
# Copy go mod and sum files
COPY go.mod go.sum ./
# Download dependencies
RUN go mod download
# Copy the source code
COPY . .
# Build the application
RUN go build -o messagemesh .
# Create a smaller final image
FROM alpine:latest
# Set working directory
WORKDIR /app
# Install necessary runtime dependencies
RUN apk add --no-cache ca-certificates
# Copy the binary from the builder stage
COPY --from=builder /app/messagemesh /app/
# Set environment variables
ENV HEADLESS=true
# Create a .env file with the required environment variables
RUN echo "HEADLESS=true" > /app/.env && \
echo "USERNAME=docker" >> /app/.env
# Expose any necessary ports (adjust as needed)
# EXPOSE 8080
# Run the application
CMD ["/app/messagemesh"]
# Build the Docker image
# docker build -t gabriellh/messagemesh .
# Run the Docker container
# docker run -d -p 8080:8080 gabriellh/messagemesh
# Push the Docker image to Docker Hub
# docker push gabriellh/messagemesh:latest