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

26 lines
523 B
Docker
Raw Normal View History

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