-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
39 lines (30 loc) · 924 Bytes
/
Dockerfile
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
# ========================
# BUILD STAGE
# ========================
# Use an official Go runtime as a parent image
FROM golang:1.20.4-alpine3.17 AS builder
# Set the working directory
WORKDIR /app
# Copy the current directory contents into the container at /app
COPY . .
# Build the Go api
RUN go build -o main main.go
# Download migrate binary
RUN apk add curl
RUN curl -L https://github.com/golang-migrate/migrate/releases/download/v4.14.1/migrate.linux-amd64.tar.gz | tar xvz
# ========================
# RUN STAGE
# ========================
# FROM alpine:3.17
# WORKDIR /app
# COPY --from=builder /app/main .
# COPY --from=builder /app/migrate.linux-amd64 ./migrate
# COPY .env .
# COPY start.sh .
# COPY wait-for.sh .
# COPY db/migrations ./migrations
# Expose port 8000 for the API
EXPOSE 8000
# Set the command to run when the container starts
CMD ["/app/main"]
# ENTRYPOINT [ "/app/start.sh" ]