Updated Dockerfile & build.yaml
All checks were successful
Build Pogdark API / Build Pogdark API (push) Successful in 36s
All checks were successful
Build Pogdark API / Build Pogdark API (push) Successful in 36s
This commit is contained in:
parent
ddbf01e9b2
commit
1e73c9c7d1
@ -17,23 +17,6 @@ jobs:
|
|||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Set up Go
|
|
||||||
uses: actions/setup-go@v4
|
|
||||||
with:
|
|
||||||
go-version: '1.22' # Specify the desired Go version
|
|
||||||
|
|
||||||
- name: Download Dependencies
|
|
||||||
run: |
|
|
||||||
go mod download
|
|
||||||
|
|
||||||
- name: Build Go Binary
|
|
||||||
run: |
|
|
||||||
go build -o pogdark-api .
|
|
||||||
|
|
||||||
- name: Confirm file presence
|
|
||||||
run: |
|
|
||||||
pwd && ls -al /workspace/public/ && ls -al .
|
|
||||||
|
|
||||||
- name: Build Docker Image
|
- name: Build Docker Image
|
||||||
run: |
|
run: |
|
||||||
docker build -t localhost:5000/pogdark-api:latest .
|
docker build -t localhost:5000/pogdark-api:latest .
|
||||||
|
33
Dockerfile
33
Dockerfile
@ -1,4 +1,31 @@
|
|||||||
FROM scratch
|
FROM golang:1.22-alpine AS builder
|
||||||
COPY pogdark-api /app/pogdark-api
|
|
||||||
|
# Set the Current Working Directory inside the container
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Copy go.mod and go.sum files to the workspace
|
||||||
|
COPY go.mod go.sum ./
|
||||||
|
|
||||||
|
# Download dependencies
|
||||||
|
RUN go mod download
|
||||||
|
|
||||||
|
# Copy the source code into the container
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# Build the Go application
|
||||||
|
RUN go build -o pogdark-api .
|
||||||
|
|
||||||
|
# Stage 2: Create a small image to run the Go application
|
||||||
|
FROM alpine:latest
|
||||||
|
|
||||||
|
# Set the Current Working Directory inside the container
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Copy the pre-built binary from the builder stage
|
||||||
|
COPY --from=builder /app/pogdark-api .
|
||||||
|
|
||||||
|
# Expose port (change if your app uses a different port)
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
CMD ["/app/pogdark-api"]
|
|
||||||
|
# Command to run the executable
|
||||||
|
CMD ["/app/pogdark-api"]
|
||||||
|
Loading…
Reference in New Issue
Block a user