This repository has been archived on 2024-12-07. You can view files and clone it, but cannot push or open issues or pull requests.
helseveileder/backend/Dockerfile
2024-01-12 22:40:56 +01:00

25 lines
529 B
Docker

# syntax=docker/dockerfile:1
# Start from the latest golang base image
FROM golang:latest AS build
# Set the Current Working Directory inside the container
WORKDIR /app
# Copy everything from the current directory to the PWD inside the container
COPY . .
# Download all the dependencies
RUN go mod download
# Build the Go app - change directory to 'cmd' where main.go resides
RUN go build -o /app/hello ./cmd
FROM alpine:latest
WORKDIR /app
COPY --from=build /app/hello .
# Command to run the executable
CMD ["./hello"]